RadImageButton is showing this error on IE 11 if the zoom level is not 100%.
- Change the zoom (not 100%)
- 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
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));
}
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;
}
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;
}
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
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?
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]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 :)