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

5 posts, 0 answers
  1. Oswaldo
    Oswaldo avatar
    1 posts
    Member since:
    Apr 2017

    Posted 06 Apr Link to this post

    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>

     

     

  2. Paweł
    Paweł avatar
    4 posts
    Member since:
    May 2014

    Posted 20 Jun in reply to Oswaldo Link to this post

    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));
    }
  3. Paweł
    Paweł avatar
    4 posts
    Member since:
    May 2014

    Posted 20 Jun Link to this post

    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;
            }

  4. Paweł
    Paweł avatar
    4 posts
    Member since:
    May 2014

    Posted 20 Jun Link to this post

    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;
            }
  5. Paweł
    Paweł avatar
    4 posts
    Member since:
    May 2014

    Posted 20 Jun Link to this post

    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

Back to Top