I have a button and an image in update panel. How do I force the image refresh by clicking on the button?
update
<b>Enter the code</b>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<uc:TextBox ID="txtCaptcha" runat="server" />
<asp:Button ID="btnRefreshCaptcha" runat="server" Text="Refresh the code" CausesValidation="false" onclick="btnRefreshCaptcha_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRefreshCaptcha" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Add random value parameter to the end of your image url and change that on each update
kind of ImageUrl = baseUrl + "?" + new Random().Next()
我使用上面的代码,但它显示了下拉列表中的脚本问题,我在主页面中给出了它,并在每个页面中将它们称为类文件。在我的编码中使用上面的代码后,我刷新验证码,它显示了重载我的页面中的下拉列表和验证码的刷新仅在出现问题后才能工作一次我无法刷新页面中的验证码图像。
Did you try
Sub btnRefresh_Click() Handles btnRefresh.Click
Me.Image.ImageUrl = "path to your image file"
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.