Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageButton does not fire a post back on IE10

Recently, we tested our products on IE10 and encountered a problem about that server button control “Asp:ImageButton” are not be fired on IE10 with UpdatePanel. And the below is the sample code:

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        Here is the content.
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="buttonSubmit" />
    </Triggers>
</asp:UpdatePanel>
<br />
<br />
<asp:Button ID="buttonSubmit" runat="server" ToolTip="Submit" OnClick="buttonSubmit_Click" />
</form>

server side:

    protected void buttonSubmit_Click(object sender, ImageClickEventArgs e)
    {
        ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "alert", "alert('It works.')", true);
    }

Here are two things which confused me: One is the issue only happens when I deployed on IIS and works fine when debugging on VS. The two is if I removed the upper two tag “br”, the event would be fired. Besides, if I change the ImageButton to Button, the event also would be fired.

So, I don’t know if I am missing something or misunderstand the life circle of the ImageButton and Button control. Any help would very appreciate.

Test environments: VS2010, IIS 7.5, IE10(10.0.9200.16484)

like image 924
Troy Avatar asked Mar 11 '13 02:03

Troy


3 Answers

Simply installing .NET Framework 4.5 can fix this problem.

This problem can be caused by the ImageButton IE10 bug which involves IE10 incorrectly converting coordinates to decimal rather than integer. This causes ImageButton clicks to fail in many, if not most, situations on IE10.

This can fix the problem even if you do not switch your application pool over to .NET Framework 4.5.

In my case, I left the app pools at .NET Framework 3.5. Apparently installing .NET Framework 4.5 overwrites some files for other framework versions.

See the workarounds section here

Related: IE10 sending image button click coordinates with decimals (floating point values) causing a ParseInt32 FormatException

like image 167
Brian Webster Avatar answered Nov 14 '22 04:11

Brian Webster


IE10 has a bug. If you develop a new aspx page and and ajaxify the page with updatepanels, the page won't work correctly.No server events will fire. But other browsers will do their job fine.I wonder why haven't microsoft noticed/fixed this issue. I handled the problem with forcing IE9 mode

<meta http-equiv="x-ua-compatible" content="IE=9" />
like image 24
Sobinscott Avatar answered Nov 14 '22 04:11

Sobinscott


Change ImageButton to a LinkButton and put the image inside of it.

It is a nice workaround, that's work for me.

like image 3
Vitor Guerreiro Avatar answered Nov 14 '22 05:11

Vitor Guerreiro