Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 297
Rob Mason Avatar asked Sep 16 '12 19:09

Rob Mason


1 Answers

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>
like image 138
p.campbell Avatar answered Nov 15 '22 16:11

p.campbell