gpt4 book ai didi

asp.net - IE10 中的 LinkBut​​tons 不执行回发

转载 作者:行者123 更新时间:2023-12-03 03:14:09 26 4
gpt4 key购买 nike

我尝试向 ASP.NET 4 页面添加一个简单的 LinkBut​​ton,但它没有调用 IE10 中的postback。代码如下所示。

HTML:

<form id="form1" runat="server">
<div>
<asp:LinkButton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click">LinkButton</asp:LinkButton>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>

C#:

protected void Page_Load(object sender, EventArgs e) { }

protected void LinkButton1_Click(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
}

如您所见,这只是一个普通页面。但是,自从升级到Win8和IE10后,我无法让LinkBut​​ton调用该方法。这在 Firefox 中工作得很好。

有什么想法我需要做什么吗?

最佳答案

这是服务器修补/更新问题。 ASP.NET 尚未发出正确的 JavaScript 供您的浏览器运行。它不知道比 IE9 更新的 IE 版本。

请参阅 Scott Hanselman 的帖子:

ASP.NET fails to detect IE10 causing _doPostBack is undefined JavaScript error or maintain FF5 scrollbar position

Scott 在 2011 年的这篇文章中指出,修复程序应通过 Windows 更新分发。确保您的服务器通过 Windows Update 获得最新的 .NET Framework 服务更新。如果没有,you can download the patchread more details on the Microsoft KB .

此修复将更新那些 .browser 文件,从而允许 ASP.NET 发出正确的标记和 JavaScript。

%WinDir%\Microsoft.NET\Framework(64?)\v4.0.30319\CONFIG\Browsers\ie.browser

这将包含这样的项目:

  <!-- Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) -->
<browser id="IE10Plus" parentID="IE6Plus">
<identification>
<capability name="majorversion" match="\d{2,}" />
</identification>
<capabilities>
<capability name="jscriptversion" value="6.0" />
</capabilities>
</browser>

关于asp.net - IE10 中的 LinkBut​​tons 不执行回发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12449934/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com