ie10 imagebutton _dopostback undefined bug with update panel script manager

IE10 has a nice new little bug which occurs with image buttons on 2nd or consecutive postback on a page which contains an update panel.

You will notice the bug as a broad javascript error message, but behind the scenes the issue occurs due to a bad type conversion to an integer from a floating point which has started to return from the .Net functions.

The official fix is a patch from Microsoft for your server, however, in the meantime you can simply apply the following in your global.asax.

Scott Hanselman has suggested a few things regarding this issue, but I think you will find the solution below to be more straightforward in the short term.

See solution below. (courtesy of R. Prestol)


'put these in global.asax.cs
Protected Sub Application_PostMapRequestHandler(sender As Object, e As System.EventArgs)
        Dim app As HttpApplication = sender
        Dim handler As IHttpHandler = app.Context.Handler
        Dim page As Page = IIf(TypeOf handler Is Page, handler, Nothing)
        If (page IsNot Nothing) Then
            AddHandler page.Load, AddressOf Page_LoadFix
        End If
    End Sub

    Private Sub Page_LoadFix(sender As Object, e As EventArgs)
        Dim page As Page = HttpContext.Current.Handler
        Dim smg As ScriptManager = ScriptManager.GetCurrent(page)
        If smg IsNot Nothing AndAlso (page.IsPostBack = False OrElse smg.IsInAsyncPostBack = False) Then
            ScriptManager.RegisterOnSubmitStatement(page, page.GetType, "IE10ImgFloatFix", "IE10ImgFloatFix();")
            ScriptManager.RegisterStartupScript(page, page.GetType, "IE10ImgFloatFix_func", "function IE10ImgFloatFix() {try {var o = Sys.WebForms.PageRequestManager._instance;var s = o._additionalInput;s = s.replace(/(.y=\d+)([.]\d+)?/g, '$1');s = s.replace(/(.x=\d+)([.]\d+)?/g, '$1');o._additionalInput = s;} catch (ex){}}", True)
        End If
    End Sub


//put these in global.asax.cs
void Application_PostMapRequestHandler(object sender, EventArgs e)
        var app = (HttpApplication)sender;
        var handler = (IHttpHandler)app.Context.Handler;
        Page page = handler as Page;
        if (page != null)
            page.Load += Page_LoadFix;

    private void Page_LoadFix(object sender, EventArgs e)
        var page = (Page)HttpContext.Current.Handler;
        var smg = ScriptManager.GetCurrent(page);
        if (smg != null && (page.IsPostBack == false || smg.IsInAsyncPostBack == false))
            ScriptManager.RegisterOnSubmitStatement(page, page.GetType(), "IE10ImgFloatFix", "IE10ImgFloatFix();");
            ScriptManager.RegisterStartupScript(page, page.GetType(), "IE10ImgFloatFix_func", "function IE10ImgFloatFix() {try {var o = Sys.WebForms.PageRequestManager._instance;var s = o._additionalInput;s = s.replace(/(.y=\\d+)([.]\\d+)?/g, '$1');s = s.replace(/(.x=\\d+)([.]\\d+)?/g, '$1');o._additionalInput = s;} catch (ex){}}", true);



About Ronnie Diaz

Ronnie Diaz is a software engineer and tech consultant. Ronnie started his career in front-end and back-end development for companies in ecommerce, service industries and remote education. This work transitioned from traditional desktop client-server applications through early cloud development. Software included human resource management and service technician workflows, online retail e-commerce and electronic ordering and fulfillment, IVR customer relational systems, and video streaming remote learning SCORM web applications. Hands on server experience and software performance optimization led to creation of a startup business focused on collocated data center services and continued experience with video streaming hardware and software. This led to a career in Amazon Prime Video where Ronnie is currently employed, building software and systems which stream live sports and events for millions of viewers around the world.

Posted on February 7, 2013, in Uncategorized and tagged , , , , , , , , , , , . Bookmark the permalink. 6 Comments.

  1. I have implemented this code in my VS2012 4.5 Framework project and it does not fix the issue in IE10 for me

    • Can you link 2-3 screenshots illustrating the error? The issue you are experiencing might be slightly different than the one I am referring to in this post but I can help you resolve it.

  2. Great!
    I’m an italian developer and i spent 2 days with this problem. You saved me! Thnaks

  3. other than thias solutions nothing helped…thanks

  4. Where do i have to place to code into. I know it’s in global.asax but it gives me runtime errors. can you give me correct place, Is it under global.asax.cs file?

    • Hi Hetal, both functions should be placed into your Global.asax.cs file. Depending on your Visual Studio project type, (website or web application), you may not see Global.asax.cs as this was usually all in one Global.asax file in website projects. In Web Application projects, the Global.asax file that does not have code (the markup file) is generally not modified.

      Also, since the name “Page_Load” is ambiguous with the page load function in pages, I changed the name of the second function in this post to “Page_LoadFix”. Both functions should go in Global.asax(.cs).

      If you receive any other errors or issues please let me know and I would be glad to help you resolve. 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: