ImageButton does not start message in IE10

We recently tested our products on IE10 and encountered a problem with the Asp: ImageButton server control button not launching in IE10 using the UpdatePanel. And 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 that confused me: One problem only occurs when deploying to IIS and works fine when debugging on VS. Two of them, if I remove the top two br tags, the event will fire. Also, if I change ImageButton to Button, the event will also fire.

So, I do not know if I am missing something or misunderstood the life circle of the ImageButton and Button control. Any help would be greatly appreciated.

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

+5
5

.NET Framework 4.5 .

ImageButton IE10, IE10 , . , ImageButton , , IE10.

, .NET Framework 4.5.

.NET Framework 3.5. , .NET Framework 4.5 .

: IE10, ( ), ParseInt32 FormatException

+6

IE10 . aspx ajaxify , . . . , Microsoft / . IE9

<meta http-equiv="x-ua-compatible" content="IE=9" />
+3

Change ImageButton to LinkButton and place the image inside it.

This is a nice workaround that works for me.

+3
source

I changed ImageButton to LinkButton and placed the button image inside it. Works.

0
source

You can do the same in Page_PreRender

private bool alert;
protected void buttonSubmit_Click(object sender, EventArgs e)
    {

        alert= true;
        ViewState["alert"] = alert;
    }

protected void Page_PreRender(object sender, EventArgs e)
    {
        if (ViewState["alert"] != null)
            alert= (bool)ViewState["alert"];
        if (alert)
        {
            alert= false;
            ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "alert", "alert('It works.')", true);

        }
    }

The update panel does not work correctly in IE 10 with button clicks, images, etc.

0
source

All Articles