Home Dashboard Directory Help
Search

ASP.net 4.0 and IE10 - Click on imagebutton in updatepanel produces error, click on normal button does not! by p_sie


Status: 

Active


64
0
Sign in
to vote
Type: Bug
ID: 755419
Opened: 7/25/2012 1:41:23 AM
Access Restriction: Public
8
Workaround(s)
view
35
User(s) can reproduce this bug

Description

Hello,

Because Windows 8 is coming out in a few months, I thought I would see how my web applications will work under Windows 8 and IE10

A problem has come to surface, that when I place a listview in an updatepanel and I use imagebuttons as the buttons (to select, undo etc.) then a click on a imagebutton in an Item of the listview gives a runtime error.

For testing purpeses I created a very simple listview inside an updatepanel.

In the InsertItemTemplate I added a button and a Imagebutton, same with the Cancel commandname:
<asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
<asp:ImageButton imageurl="~/images/undo.png" ID="ImageButton1" runat="server" CommandName="Cancel" />
A click on the Button works like it should... A click on the ImageButton gives an error. In the eventlog on the server the following error
is saved:

Exception message: Input string was not in a correct format.

at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)

at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)

at System.Web.UI.WebControls.ImageButton.LoadPostData(String postDataKey, NameValueCollection postCollection)

at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)



When I use IE10 in compatibility mode, it works OK
Anyone any clue why this is and how to correct the error (and I don't want to switch to the Big buttons inside my listview items, cause they take to much space!)

Hope to hear from anyone...


P.S. same bug in .net 3.5 when viewing the site in IE10!
Details
Sign in to post a comment.
Posted by Jose Geraldo on 9/20/2013 at 1:42 PM
ESPERO AJUDAR COM O COMENTÁRIO.

Eu tive este problema numa aplicação Asp.net 4.0 - utilizando o ajaxcontrol toolkit 3.5.
A versão do Ajax é AjaxControlToolkit 3030930
Ainda bem que eu tinha os fontes da versão.
Alterei o código fonte do AjaxControlToolkit 3030930, gerei nova DLL, removi a antiga do projeto,
referenciei a nova DLL, testei e funcionou legal.

Nos fontes do ajaxcontroltoolkit, aberta a solução no visual stuido 2010, CTRL Shift F
        return new Sys.UI.Point(

encontrei e acrescentei as linhas abaixo

        if (typeof offsetX === "number") {
            offsetX = Math.round(offsetX);
        }

        if (typeof offsetY === "number") {
            offsetY = Math.round(offsetY);
        }

     return new Sys.UI.Point(offsetX, offsetY);


conforme a solução apontada aqui por Hemendra Shah.

Muito obrigado ai Hemendra.
Posted by Microsoft on 6/16/2013 at 9:50 PM
Thanks for your feedback. Recently we released several GDRs for IE related bugs. You may want to have a try on these patches.

.Net 4.0
http://support.microsoft.com/kb/2836939

.Net 2.0
http://support.microsoft.com/kb/2836943
http://support.microsoft.com/kb/2836942
Posted by HorsetoothBrian on 5/21/2013 at 12:30 PM
I replicated this issues as well. Installing 4.5 on the server fixed this, but it is still broken in 4.0.
Posted by Renato Mattos on 5/13/2013 at 2:56 PM
Any solution to the problem? Because for me to change planning framework without other bugs may appear.
The suggestion metatage X-UA-Compatible does not work.
The solution to edit MicrosoftAjax.js can not do, where to find this file?
Posted by Hemendra Shah on 5/1/2013 at 6:06 AM
I spent a lot...

I figure out the one option. I have modified the MicrosoftAjax.js and MicrosoftAjax.debug.js file for rounding the point value before returning Sys.UI.Point for all areas - see as below.

            if (typeof param1 === "number")
            {
                param1 = Math.round(param1);
            }

            if (typeof param2 === "number")
            {
                param2 = Math.round(param2);
            }

            return new Sys.UI.Point(param1, param2);


I have referenced modified js file using Script option in ScriptManager code of ASPX page. Thats it done.

I hope it helps other.
Posted by Hemendra Shah on 4/30/2013 at 11:24 PM
I have application using .NET 2.0 with Ajax-toolkit 1.0 and running application under IE 10, I have the same issue of SCRIPT5022: Sys.ArgumentOutOfRangeException: Value must be an integer.

I have already tried below things.
    1. I have installed hot-fix KB2784148 Windows 7 SP1, which does not worked for me.
    2. I have installed hot-fix KB2600100, which is to resolve another issue of _doPostBack.
    3. It works while running application under the IIS application pool with .NET 4.0/4.5.
            3.1 I keep this approach as secondary as it may involves risk for other functionality of our application.
    4. It works fine with compatibility change, which is not preferred.
    5. Adding JS code for changing x and y, which does not worked for me.
    6. Overriding LoadPostData, not tried as needs more detail for this.
    7. Border setting not useful even application not using Iframe.

I have faced issue with Button control apart from ImageButton.

I have provided simple code to reproduce the issue under the Ajax Enabled website in .NET 2.0 with VS2005.

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
            <asp:TextBox ID="txtDesc" TabIndex="9" runat="server" Width="90%" Text="Test data"></asp:TextBox>
            <asp:Button ID="btnSearch" TabIndex="7" runat="server" Text="Search"></asp:Button>
        </div>
    </form>

I look forward the resolution for this issue. Thanks in advance.
Posted by Kiyokura on 1/28/2013 at 5:13 AM
Today, I apply HotFix(kb2784147) to Windows 2003 Server, bat still unresolve in ASP.NET 2.0 apps.
And, this problem occured on IE 10 preivew on Windows 7.

Posted by metal0xide on 1/21/2013 at 6:57 AM
This is still unresolved in .NET 3.5. Any plans to fix?
Posted by Microsoft on 12/31/2012 at 1:15 AM
please check below links for more details.
http://support.microsoft.com/kb/2783767 (.net 4.0)
http://support.microsoft.com/kb/2784147 (.net 2.0)
http://blogs.technet.com/b/hot/archive/2012/12/27/dec-18-dec-24-hot-fix-kb-articles-weekly-release-net-framework.aspx

Posted by mrspangle on 12/27/2012 at 6:40 AM
@Satish S

What I meant was that MS have changed the behaviour in their browser (to transmit coordinates as decimal), but have forgot to update the code in LoadPostData which assumes that value as being an integer and falls over.

In the end we wrote a HttpModule which reads every form post and converts the decimal X & Y to integer before LoadPostData is called. We installed it server wide and is currently working for .net 1, 2, 3.5 + 4 web apps.

What I do not understand is why MS changed this in the first place?
Posted by kenb111111 on 12/12/2012 at 8:30 AM
We are also experiencing this problem with ASP.Net 4 WebForms image buttons when a user has Windows 8 & Internet Explorer and are planning on Installing .Net 4.5 on our web servers (to avoid making code changes).

Does anyone know if Installing .Net 4.5 will cause any other issues with Webforms?

Are there any other known issues?

We don't want to solve this problem only to encounter others?
Posted by g_hodges on 10/26/2012 at 11:27 AM
I added a workaround that works by overriding the x and y coordinates with javascript.
Posted by bpell on 10/18/2012 at 4:22 PM
I had posted that telling the page to render for IE8/IE9 works. However, I have found that when *that* page is in an IFrame it depends on the parent page (and when you don't have control over the parent page creating the IFrame it means that the page still breaks because IE renders for the parent page).
Posted by Satish S on 9/19/2012 at 10:31 PM

.NET Framework version 2.0.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.imagebutton.loadpostdata(v=vs.80).aspx

.NET Framework version 4.5.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.imagebutton.loadpostdata.aspx

mrspangle,

Above links says there is no changes. do you mean to say the above? could you please confirm.

Microsoft,

is our observations are correct?





Posted by mrspangle on 9/19/2012 at 4:57 AM
The issue is that Microsoft have changed the X and Y coordinate that is transmitted in a form post from an integer to double when clicking on an imagebutton.

The LoadPostData function in ImageButton class is doing:

Integer.Parse(val)

Where val is either the X and Y co-ordinate.

In all other browsers prior to IE10 the co-odinate will be an integer, in IE10 will be a double.

Why microsoft??? Who needs less than a pixel accuracy?
Posted by Satish S on 9/18/2012 at 2:36 AM
Please note:

Our application is developed in Framework 2.0 and we are making our application to work in windows8 and 2012 with IE10 and pointing to Framework 2.0


Please Refer the below link for the detail of the issue.

http://forums.asp.net/post/5145646.aspx

Our observations:

1.In IE 10 ToolKitScriptManager is NOT ABLE TO IDENTIFY the image button id when page is making Asynchronous post back because of update panel.

2.If we register the image button control to the " ToolkitScriptManager" after button is created. then we are not observing this issue in IE10.

Below is the sample code which we registered to " ToolkitScriptManager" for your reference

                ImageButton imgbtn = new ImageButton();
                imgbtn.ID = "img";
                imgbtn.ImageUrl = @"./btn_login.png";
                imgbtn.Command += new CommandEventHandler(OnCancelClick);
                imgbtn.CommandName = "OnCancelClick";
                imgbtn.CausesValidation = false;
                ToolkitScriptManager tkt = (ToolkitScriptManager)Master.FindControl("ToolkitScriptManager");
                tkt.RegisterPostBackControl(imgbtn);

3.we observe when Imagebutton declared as static in aspx page also needs "PostbackTigger" to be added.

<asp:UpdatePanel ID="upbuttons" runat="server" UpdateMode="Always">
        <ContentTemplate>
        <div class="right">
            <asp:ImageButton ID="Button_UpdateStatus" runat="server" />
        </div>
         <div class="right">
            <asp:ImageButton Visible="false" ID="Button_UpdateStopStatus" runat="server"/>
        </div>
        </ContentTemplate>
        <Triggers>
        <asp:PostBackTrigger ControlID="Button_UpdateStatus" />
        <asp:PostBackTrigger ControlID="Button_UpdateStopStatus" />
        </Triggers>
        </asp:UpdatePanel>
Our Queries:

1.We would like to know whether the fix what we made above is Correct?
2.Is IE10 following any new standards other than HTML5?
3.Only IE10 browser is expecting the image button ID to be created every time to map during post back.
4.please confirm whether "ToolKitScriptManager" and "Update Panel" is having any issues in IE10 windows 8 and windows 2012.
Posted by p_sie on 9/18/2012 at 1:37 AM
@Microsoft

By using

    <httpProtocol>
     <customHeaders>
        <clear />
        <add name="X-UA-Compatible" value="IE=9" />
     </customHeaders>

in the system.webServer node in the web.config file, the site works.
Posted by Microsoft on 9/17/2012 at 3:23 PM
This issue was fixed in .NET 4.5. We are investigating supplying a fix for .NET 4.0. In the meantime, you might try using the X-UA-Compatibility http-equiv meta tag (or header) to force IE into IE9 rendering mode.
Posted by Satish S on 9/14/2012 at 4:40 AM
Observed same type of issue, please refer the below link for issue details.

http://forums.asp.net/post/5145646.aspx


Posted by Superfly. _ on 8/22/2012 at 1:02 PM
I was able to work around this problem by installing .NET Framework 4.5 on our Windows 2008 R2 IIS server.
Posted by Superfly. _ on 8/21/2012 at 12:22 PM
I can confirm the same issues with my companies webportal.

1. I have a list view inside and updatepanel. I have 3 ImageButtons that call an invoiceDetails_Click Sub. When I click on any of the buttons it generates the "Input string was not in a correct format." error.

2. If I turn compatibility view on the buttons work.

3. If I change from an ImageButton to a LinkButton it works as well.
Posted by Microsoft on 7/26/2012 at 11:29 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by p_sie on 7/26/2012 at 1:53 AM
When I create a new project it works ok?!
But existing projects have been affected.
In an existing project I created a new page with the following code:
<asp:Content ID="Content2" ContentPlaceHolderID="main" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:ImageButton ID="ImageButton2" runat="server"
                ImageUrl="~/images/pijlbeneden.png" />
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

Sorry, but I am not allowed to send you the original projects. Maybe you can find something in the
web.config file:

<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
</configSections>
<connectionStrings>
    <add name="XXX" connectionString="Data Source=localhost;Initial Catalog=XXX;Persist Security Info=True;User ID=xxx;Password=xxx" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
    <httpHandlers>
     <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
    </httpHandlers>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
     <assemblies>
        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
     </assemblies>
     <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
     </buildProviders>
    </compilation>
</system.web>
<system.web>
    <customErrors defaultRedirect="fout.aspx" redirectMode="ResponseRedirect" mode="RemoteOnly"></customErrors>
    <authentication mode="Forms">
     <forms loginUrl="~/login.aspx" protection="All" name=".ASPXAUTH" timeout="2880" slidingExpiration="true"/>
    </authentication>
    <authorization>
     <deny users="?" />
     <allow users="*" />
    </authorization>
</system.web>
<system.net>
    <mailSettings>
     <smtp from="xxx">
        <network host="xxx" port="25" password="" userName=""/>
     </smtp>
    </mailSettings>
</system.net>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
     <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </handlers>
</system.webServer>
</configuration>
Posted by Microsoft on 7/25/2012 at 7:47 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a demo project to demonstrate this issue so that we can conduct further research?

We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 7/25/2012 at 1:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by jefftastic on 10/23/2013 at 10:06 AM
I changed the ImageButton to a LinkButton and put the button image inside of it. Works.
Posted by grahammendick on 5/24/2013 at 9:15 AM
Here's a JavaScript workaround. It overrides the existing method, floors the x and y coordinates then calls the existing method with these new coordinates.

        Sys.WebForms.PageRequestManager.getInstance()._origOnFormActiveElement = Sys.WebForms.PageRequestManager.getInstance()._onFormElementActive;
        Sys.WebForms.PageRequestManager.getInstance()._onFormElementActive = function(element, offsetX, offsetY){
            if (element.tagName.toUpperCase() === 'INPUT' && element.type === 'image'){
                offsetX = Math.floor(offsetX);
                offsetY = Math.floor(offsetY);
            }
            this._origOnFormActiveElement(element, offsetX, offsetY);
        };
Posted by Hemendra Shah on 5/1/2013 at 6:07 AM
I spent a lot...

I figure out the one option. I have modified the MicrosoftAjax.js and MicrosoftAjax.debug.js file for rounding the point value before returning Sys.UI.Point for all areas - see as below.

            if (typeof param1 === "number")
            {
                param1 = Math.round(param1);
            }

            if (typeof param2 === "number")
            {
                param2 = Math.round(param2);
            }

            return new Sys.UI.Point(param1, param2);


I have referenced modified js file using Script option in ScriptManager code of ASPX page. Thats it done.

I hope it helps other.
Posted by NickG on 4/17/2013 at 9:02 AM
This hot-fix claims to fix the problem but is not yet publicly released (you have to obtain it from MS Support):
http://support.microsoft.com/kb/2783767 (search for "asp.net issue" within this page)
Posted by timmkrause on 12/17/2012 at 11:46 PM
http://support.microsoft.com/kb/2600088
http://support.microsoft.com/kb/2600100

http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx
Posted by g_hodges on 10/26/2012 at 11:25 AM
Another guy I work with wrote this code, so I don't know exactly how it works but it overrides the auto generated .Net javascript code involved with the x y coordinates. This resolved the issue for us, we're on the 4.0 Framework. Hopefully it will help someone else.

// Patch fractional .x, .y form parameters for IE10.
if (typeof(Sys) !== 'undefined' && Sys.Browser.agent === Sys.Browser.InternetExplorer && Sys.Browser.version === 10)
{
    Sys.WebForms.PageRequestManager.getInstance()._onFormElementActive = function Sys$WebForms$PageRequestManager$_onFormElementActive(element, offsetX, offsetY) {
        if (element.disabled) {
            return;
        }
        this._activeElement = element;
        this._postBackSettings = this._getPostBackSettings(element, element.name);
        if (element.name) {
            var tagName = element.tagName.toUpperCase();
            if (tagName === 'INPUT') {
                var type = element.type;
                if (type === 'submit') {
                    this._additionalInput = encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value);
                }
                else if (type === 'image') {
                    this._additionalInput = encodeURIComponent(element.name) + '.x=' + Math.floor(offsetX) + '&' + encodeURIComponent(element.name) + '.y=' + Math.floor(offsetY);
                }
            }
            else if ((tagName === 'BUTTON') && (element.name.length !== 0) && (element.type === 'submit')) {
                this._additionalInput = encodeURIComponent(element.name) + '=' + encodeURIComponent(element.value);
            }
        }
    };
}
Posted by bpell on 10/18/2012 at 10:07 AM
Not great, but I added this one tag below the HTML tag:

<meta http-equiv="X-UA-Compatible" content="IE=8" />

Most of these pages for me were developed originally on IE8 so this works for me for now. This allowed the ImageButtons to correctly function.
Posted by Superfly. _ on 8/23/2012 at 8:57 AM
Installing .NET Framework 4.5 on our server seems to have fixed this issue.