[英]Force refresh image in update panel
我在更新面板中有一个按钮和一个图像。 如何通过单击按钮强制刷新图像?
更新
<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>
将随机值参数添加到图像URL的末尾,并在每次更新时更改该值
种类ImageUrl = baseUrl +“?” + new Random()。Next()
我使用上面的代码,但它显示了下拉列表中的脚本问题,我在主页面中给出了它,并在每个页面中将它们称为类文件。在我的编码中使用上面的代码后,我刷新验证码,它显示了重载我的页面中的下拉列表和验证码的刷新仅在出现问题后才能工作一次我无法刷新页面中的验证码图像。
你试过了吗
Sub btnRefresh_Click() Handles btnRefresh.Click
Me.Image.ImageUrl = "path to your image file"
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.