点击LinkButton
,我刷新图像控件中的图像而不刷新页面。为此,我使用了UpdatePanel
和AsyncPostBackTrigger
。UpdatePanel仅适用于Chrome,不适用于IE/Mozilla。为什么?
它在镀铬中工作完美。但不是在IE和Mozilla中。在IE和Mozilla上,当我点击链接按钮时,没有任何反应。看起来很奇怪。对此有任何线索?
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="txtCaptchaInput" BorderStyle="Solid" Style="vertical-align: top" runat="server" Width="106px" BorderWidth="1px"></asp:TextBox>
<asp:Image ID="img_captcha" runat="server" Height="32px" ImageUrl="~/captchaJPEG.aspx" Width="108px" />
<asp:LinkButton ID="captcha_refresh" runat="server">Refresh Image</asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="captcha_refresh" />
</Triggers>
</asp:UpdatePanel>
CaptchaJPEG.aspx:页面加载
Dim captcha As New Captcha.CaptchaImage()
captcha.width = 150
captcha.height = 40
captcha.text = Me.Session("CaptchaText").ToString()
captcha.GenerateImage()
captcha.image.Save(Me.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
检查你得到的JavaScript错误!此外链接按钮不叫任何功能!也许这是问题? – Aristos 2013-05-13 13:36:25
@Aristos Mozilla中没有javascript错误。链接按钮有一个点击事件,点击Mozilla和Chrome中的链接按钮时会正确触发。问题是,除mozilla之外的浏览器中图像不会发生变化 – Anuya 2013-05-13 13:47:10
然后,也许图像停留在缓存上,需要制作一些技巧来强制更新。现在,我看到它更好,您使用一个页面发送图像。更好地使用处理程序。 – Aristos 2013-05-13 13:50:55