System.FormatException: Input string was not in a correct format error is thrown on Chrome when browser is zoomed in/out

3 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1679 posts
    Member since:
    Oct 2004

    Posted 08 Dec 2014 Link to this post

    When Chrome browser is zoomed in/out System.FormatException: Input string was not in a correct format error is thrown. This is an issue introduced with the latest version of Chrome browser (39.0.2171.71) which started setting the scroll position as a floating point number rather than an integer. The affected Telerik controls are: RadScheduler, RadListBox, RadTreeView. This problem has been addressed in the Q3 2014 SP1 release, but if you are currently unable to upgrade use the code snippet solutions below:

    RadScheduler:
    <script type="text/javascript">
           Telerik.Web.UI.RadScheduler.prototype.saveClientState = function () {
               return '{"scrollTop":' + Math.round(this._scrollTop) + ',"scrollLeft":' + Math.round(this._scrollLeft) + ',"isDirty":' + this._isDirty + '}';
           }
    </script>

    RadListBox:
    <script type="text/javascript">
          Telerik.Web.UI.RadListBox.prototype.saveClientState = function () {
              return "{" +
              "\"isEnabled\":" + this._enabled +
              ",\"logEntries\":" + this._logEntriesJson +
              ",\"selectedIndices\":" + this._selectedIndicesJson +
              ",\"checkedIndices\":" + this._checkedIndicesJson +
              ",\"scrollPosition\":" + Math.round(this._scrollPosition) +
              "}";
          }
      </script>

    RadTreeView:
    <script type="text/javascript">
           Telerik.Web.UI.RadTreeView.prototype.saveClientState = function () {
               return "{\"expandedNodes\":" + this._expandedNodesJson +
               ",\"collapsedNodes\":" + this._collapsedNodesJson +
               ",\"logEntries\":" + this._logEntriesJson +
               ",\"selectedNodes\":" + this._selectedNodesJson +
               ",\"checkedNodes\":" + this._checkedNodesJson +
               ",\"scrollPosition\":" + Math.round(this._scrollPosition) + "}";
           }
       </script>

  2. Inian
    Inian avatar
    3 posts
    Member since:
    Mar 2016

    Posted 27 Sep in reply to Telerik Admin Link to this post

    When I use this script block, ended up with "Uncaught ReferenceError: Telerik is not defined" in browser console.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Inian
    Inian avatar
    3 posts
    Member since:
    Mar 2016

    Posted 27 Sep in reply to Inian Link to this post

    Its working. Just pasted the script in main content of aspx. 
Back to Top