IE7 bug using image button in AJAX

Last post 07-03-2009 4:33 AM by rainynight. 12 replies.

Sort Posts:

  • IE7 bug using image button in AJAX

    11-08-2006, 3:44 PM
    • Member
      700 point Member
    • SixString
    • Member since 08-04-2003, 10:06 PM
    • Posts 140

    Hi ;)

     I been testing a form with a asp.net image button inside of the UpdatePanel ...it works ok if you click in a safe area of the image , but if clicked on the edge of the image this message apears "Input string was not in a correct format." and the event dosent happen ......this appens in IE7 final ...in Firefox it dosent appen.

     Does anyone also have this strange beaviour??

     Thanks and Cheers

    Filed under:
  • Re: IE7 bug using image button in AJAX

    11-08-2006, 9:31 PM
    • Participant
      1,216 point Participant
    • Rasetti
    • Member since 04-17-2006, 10:40 PM
    • Auckland, New Zealand
    • Posts 286

    I had this problem before.

    I think, and others in the forum suggested it too, that it's related with 404 responses (file not found), that, for some reason, ajax throws when you click on and image to trigger the async postback.

    To "fix" it, I just added some javascript to ignore the error, because, in my case, it was happening randomly and it didn't actually break the application, so the user just has to click again. Here is my code, which, btw, is an adaptation from the tutorials found on the ajax site:

    <script type="text/javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args)
    {
    if (args.get_error() != undefined && args.get_error().httpStatusCode == '500')
    {
    var errorMessage = args.get_error().message;
    args.set_errorHandled(
    true);
    }
    }
    </script>

     Cheers,

    Juan

    Juan Barrera
    MCTS


    Please remember to click "Mark as Answer" on this post if it helped you.
  • Re: IE7 bug using image button in AJAX

    11-08-2006, 9:44 PM
    • Member
      700 point Member
    • SixString
    • Member since 08-04-2003, 10:06 PM
    • Posts 140

    Hi

     Thanks for your help my friend ..but for some reason its not working...i get the same error

     Thanks

  • Re: IE7 bug using image button in AJAX

    11-08-2006, 9:55 PM
    • Participant
      1,216 point Participant
    • Rasetti
    • Member since 04-17-2006, 10:40 PM
    • Auckland, New Zealand
    • Posts 286

    SixString,

    I'm just using that code as a workaround, to get rid of the javascript popup message, and make the user click again. In my case, the user would click again on another part of the image, but I never actually "fixed" the problem. 

    If the workaround is not enough for you, and you really need you user to be able to click the edge of the image, my solution is not going to work for you.

    BTW, could you at least be able to get rid of the javascript popup alert?

    Cheers
    Juan 

    Juan Barrera
    MCTS


    Please remember to click "Mark as Answer" on this post if it helped you.
  • Re: IE7 bug using image button in AJAX

    11-08-2006, 10:17 PM
    • Member
      700 point Member
    • SixString
    • Member since 08-04-2003, 10:06 PM
    • Posts 140

    Hi ...

    I still get the message ...the strange thing is that this dosent happen in Firefox ...

     heres a image of what really happens when the button its not clicked right in the midlle "ImageClickError"

    I didnt tried it in IE6 so i dont know if that happens there to

     Thanks

  • Re: IE7 bug using image button in AJAX

    11-08-2006, 10:24 PM
    • Participant
      1,216 point Participant
    • Rasetti
    • Member since 04-17-2006, 10:40 PM
    • Auckland, New Zealand
    • Posts 286

    Ok, so it seems that the javascript code is not working there.

    Make sure that you insert the javascript into the page (or master page) that contains the ScriptManager. In my case, the code is like this

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" ScriptMode="Release" />

    <script type="text/javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args)
    {
    if (args.get_error() != undefined && args.get_error().httpStatusCode == '500')
    {
    var errorMessage = args.get_error().message;
    args.set_errorHandled(
    true);
    }
    }
    </script>

     .....more code follows, but you get the point.

     

     And, in the code behind, use the ScriptManager_AsyncPostBackError method to trap and clear the error:

    Protected Sub ScriptManager1_AsyncPostBackError(ByVal sender As Object, ByVal e As Microsoft.Web.UI.AsyncPostBackErrorEventArgs) Handles ScriptManager1.AsyncPostBackError
    If e.Exception.Message = "Input string was not in a correct format." Then
    Server.ClearError()
    Else
    ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message
    End If
    End Sub

     

    It should work! :)

     

     

    Juan Barrera
    MCTS


    Please remember to click "Mark as Answer" on this post if it helped you.
  • Re: IE7 bug using image button in AJAX

    11-08-2006, 10:40 PM
    • Member
      700 point Member
    • SixString
    • Member since 08-04-2003, 10:06 PM
    • Posts 140

    Thanks so mutch my friend ...that realy did the job!

    Cheers

  • Re: IE7 bug using image button in AJAX

    11-08-2006, 10:45 PM
    • Participant
      1,216 point Participant
    • Rasetti
    • Member since 04-17-2006, 10:40 PM
    • Auckland, New Zealand
    • Posts 286

    I'm glad it worked!

    Juan

    Juan Barrera
    MCTS


    Please remember to click "Mark as Answer" on this post if it helped you.
  • Re: IE7 bug using image button in AJAX

    11-08-2006, 11:38 PM
    • Member
      534 point Member
    • purell
    • Member since 06-30-2006, 2:17 AM
    • Posts 206
    I tried this code in my masterpage, but I get Sys is undefined error?
  • Re: IE7 bug using image button in AJAX

    11-08-2006, 11:40 PM
    • Member
      534 point Member
    • purell
    • Member since 06-30-2006, 2:17 AM
    • Posts 206
    Never mind I had to put the javascript after the scriptmanager. lol
  • Re: IE7 bug using image button in AJAX

    11-09-2006, 5:38 AM
    • Member
      427 point Member
    • niallhannon
    • Member since 03-23-2006, 2:50 PM
    • Posts 125

    Hi,

     I also get this problem. Using IE7 final and beta 2 of MS Ajax.

     I will try the work around, but does anyone know if this is going to be fixed in the next release?

     Thanks

    N

  • Re: IE7 bug using image button in AJAX

    11-09-2006, 2:46 PM
    • Participant
      1,216 point Participant
    • Rasetti
    • Member since 04-17-2006, 10:40 PM
    • Auckland, New Zealand
    • Posts 286

    That would be something to ask to the AJAX team, but as it seems to be a common problem I think they should really try to fix it.

    Cheers,

    Juan

    Juan Barrera
    MCTS


    Please remember to click "Mark as Answer" on this post if it helped you.
  • Re: IE7 bug using image button in AJAX

    07-03-2009, 4:33 AM
    • Member
      9 point Member
    • rainynight
    • Member since 06-02-2006, 4:24 AM
    • Posts 3

    Hi friends

    I have the same problem with IE 8 and Anthem.NET ajax library

    Unfortunately i could not solve the problem with this solution but i have another solution for this problem :

    just use a LinkButton with Image control inside instead of ImageButton like this :

    <asp:LinkButton ID="btnRemove" runat="server" CommandArgument='<%# Eval("DemandID") %>' CommandName="delete"
    <asp:Image runat="server" ImageUrl="~/Icons/Small/remove.png" ID="imgDelete" />
    </asp:LinkButton>



Page 1 of 1 (13 items)