This is a migrated thread and some comments may be shown as answers.

RadImageButton error with zoom level: "Input string was not in a correct format"

7 Answers 116 Views
Button
This is a migrated thread and some comments may be shown as answers.
Oswaldo
Top achievements
Rank 1
Oswaldo asked on 06 Apr 2017, 02:46 PM

RadImageButton is showing this error on IE 11 if the zoom level is not 100%.

  1. Change the zoom (not 100%)
  2. Click on the Img button

[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +10896279
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +145
   Telerik.Web.UI.RadImageButton.LoadPostData(String postDataKey, NameValueCollection postCollection) +167
   Telerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +16
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +734
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1960

 

This is the aspx code 

<telerik:RadImageButton ID="ButtonActions1" runat="server" Image-Url="~/Images/menu.png"  ></telerik:RadImageButton>

 

 

7 Answers, 1 is accepted

Sort by
0
Paweł
Top achievements
Rank 1
answered on 20 Jun 2017, 10:04 AM
Workaround from this link helped me fixing issue:

https://feedback.telerik.com/Project/108/Feedback/Details/210060-radimagebutton-throws-input-string-was-not-in-a-correct-format-in-ie-when-zoome

I added this code in jquery ready event:

Telerik.Web.UI.Button.ImageCoordsFunctionality.prototype._calculateCoords = function (e) {
var container = this._ui.element;
var pos = $telerik.getLocation(container);
var scroll = $telerik.getScrollOffset(container, true);

return new Telerik.Web.UI.Point(parseInt(e.clientX + scroll.x - pos.x), parseInt(e.clientY - pos.y + scroll.y));
}
0
Paweł
Top achievements
Rank 1
answered on 20 Jun 2017, 10:07 AM

Problem is with parsing x and y in RadImageButton's LoadPostData:

Example data:

control_ctlUserMarketList_radGrdUserMarketList_ctl00_ctl04_btnMarketLoad.x=8.1199951171875
control_ctlUserMarketList_radGrdUserMarketList_ctl00_ctl04_btnMarketLoad.y=8.1199951171875

 

protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            bool result = base.LoadPostData(postDataKey, postCollection);
            string name = this.ClientID + ".x";
            string name2 = this.ClientID + ".y";
            if (postCollection[name] != null && postCollection[name] != "NaN")
            {
                this.X = int.Parse(postCollection[name].ToString());
            }
            if (postCollection[name2] != null && postCollection[name2] != "NaN")
            {
                this.Y = int.Parse(postCollection[name2].ToString());
            }
            return result;
        }

0
Paweł
Top achievements
Rank 1
answered on 20 Jun 2017, 10:08 AM

Problem is with RadImageButton's method LoadPostData - parsing to int.

 

control_ctlUserMarketList_radGrdUserMarketList_ctl00_ctl04_btnMarketLoad.x=8.1199951171875

control_ctlUserMarketList_radGrdUserMarketList_ctl00_ctl04_btnMarketLoad.y=8.1199951171875

 

protected override bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            bool result = base.LoadPostData(postDataKey, postCollection);
            string name = this.ClientID + ".x";
            string name2 = this.ClientID + ".y";
            if (postCollection[name] != null && postCollection[name] != "NaN")
            {
                this.X = int.Parse(postCollection[name].ToString());
            }
            if (postCollection[name2] != null && postCollection[name2] != "NaN")
            {
                this.Y = int.Parse(postCollection[name2].ToString());
            }
            return result;
        }
0
Paweł
Top achievements
Rank 1
answered on 20 Jun 2017, 10:09 AM

Problem is with RadImageButton's method LoadPostData

 

Example data:
control_ctlUserMarketList_radGrdUserMarketList_ctl00_ctl04_btnMarketLoad.x=8.1199951171875
control_ctlUserMarketList_radGrdUserMarketList_ctl00_ctl04_btnMarketLoad.y=8.1199951171875

0
ww1711
Top achievements
Rank 1
answered on 26 Mar 2018, 01:30 PM

Hi Pavel,

I've tried to implement this block of code and I can't seem to get it to work... The "_ui" object is undefined when I attempt accessing it via: "this._ui.element;"

Any thoughts?

0
ww1711
Top achievements
Rank 1
answered on 26 Mar 2018, 01:32 PM

apologies for typo in your name, PaweÅ‚*[quote]

ww1711 said:

Hi Pavel,

I've tried to implement this block of code and I can't seem to get it to work... The "_ui" object is undefined when I attempt accessing it via: "this._ui.element;"

Any thoughts?

[/quote]
0
Paweł
Top achievements
Rank 1
answered on 26 Mar 2018, 06:46 PM

Hi,

 

Currently I don't have access to that code to test it, but I'm guessing maybe it's different version of controls.

This should be fixed in R2 2017 SP1 as stated in link I provided (https://feedback.telerik.com/Project/108/Feedback/Details/210060-radimagebutton-throws-input-string-was-not-in-a-correct-format-in-ie-when-zoome)

 

However, you could temporary have this code:
Telerik.Web.UI.Button.ImageCoordsFunctionality.prototype._calculateCoords = function (e) {
var container = this;

debugger;

}
Then test in chrome and open developer tools (F12) and check in debug how "this" object looks like.

Maybe you will find different property name than _ui which has "element" property.

Good luck :)

Tags
Button
Asked by
Oswaldo
Top achievements
Rank 1
Answers by
Paweł
Top achievements
Rank 1
ww1711
Top achievements
Rank 1
Share this question
or