简体   繁体   中英

LinkButtons in IE10 not performing posting back

I'm trying to add a simple LinkButton to an ASP.NET 4 page but it's not calling the postback in IE10. The code looks like as follows.

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();
}

As you can see, it's just a plain page. However, I cannot get the LinkButton to call the method since upgrading to Win8 and IE10. This works fine with Firefox.

Any ideas what I need to do?

This is a server patching/updating problem. ASP.NET has not emitted the correct JavaScript for your browser to run. It's not aware of IE versions newer than IE9.

See Scott Hanselman's post on this:

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

Scott notes in this 2011 post that the fix should be distributed via Windows Update. Ensure your server is up to date with .NET Framework service updates from Windows Update. If not, you can download the patch or read more details on the Microsoft KB .

The fix will update those .browser files allowing ASP.NET to emit the correct markup and JavaScript.

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

This will contains items like this:

  <!-- 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>

You have patch who patch introduces the updated definitions in the browser definition files for Internet Explorer and Mozilla Firefox. The browser definition files are stored in the following folders, depending on the installed version of Microsoft Framework le.NET:

For 32-bit versions of the Framework 4.0.NET

% WinDir% \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\ CONFIG \\ Browsers

For 64-bit versions of the Framework 4.0.NET

% WinDir% \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ CONFIG \\ Browsers

Download Patch here : http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=2600088&kbln=fr

Link : http://support.microsoft.com/kb/2600088

It was due to the security settings in IE10. For some reason my local intranet settings were stricter than public websites. So I couldn't click on hyperlinks, but I could click on buttons which submitted forms.

你应该安装.Net Framework 4.5,它对我有用。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM