LinkButtons in IE10 not performing posting back

情到浓时终转凉″ 提交于 2019-12-23 07:28:47

问题


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?


回答1:


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>



回答2:


Explanation about the error:

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

If you want the direct download (Framework 4.0) to the Hotfix is:

http://hotfixv4.microsoft.com/.NET%20Framework%204.0%20-%20Windows%20XP,%20Windows%202003,%20Windows%20Vista,%20Windows%20Server%202008,%20Win7,%20Windows%20Server%202008%20R2%20(MSI)/nosp/DevDiv953277/30319.504/free/436907_intl_x64_zip.exe




回答3:


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




回答4:


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.




回答5:


You should install .Net Framework 4.5, it worked for me.




回答6:


You need to install a hotfix for this. Scott Hanselman explains this on his blog.

http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx



来源:https://stackoverflow.com/questions/12449934/linkbuttons-in-ie10-not-performing-posting-back

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!