Completed
Last Updated: 03 Nov 2015 11:47 by Asad
ADMIN
Hristo Valyavicharski
Created on: 26 Nov 2014 08:15
Category: UI for ASP.NET AJAX
Type: Bug Report
7
FIX: "System.FormatException: Input string was not in a correct format." thrown on Chrome when browser is zoomed in/out.
System.Exception: 453.6 is not a valid value for Int32.
19 comments
Asad
Posted on: 03 Nov 2015 11:47
body {
            zoom: 1.0 !important;
            -moz-transform: scale(1) !important;
            -moz-transform-origin: 0 0 !important;
        }
$(document).ready(function () {
            $(document).keydown(function (event) {
                if (event.ctrlKey == true && (event.which == '107' || event.which == '109' || event.which == '187' || event.which == '189')) {
                    event.preventDefault();
                }
            });

            $(window).bind('mousewheel DOMMouseScroll', function (event) {
                if (event.ctrlKey == true) {
                    event.preventDefault();
                }
            });
        })
SHERFUDEEN
Posted on: 15 Dec 2014 10:25
I found the work around for my issue.

Actually, I placed the javascript in my Master page. So it is giving error, if the child page doesn't contains RadListBox. 

if (Telerik.Web.UI.RadListBox != undefined) {
                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) +
                           "}";
                }
            }
Keith
Posted on: 13 Dec 2014 11:34
We're using RadTreeView.Net2.dll (6.3.3.0) and appear to be having a similar problem.  We will migrate to the latest and greatest Telerik.Web.UI but this will take us a little while.  A temporary workaround would help us in the meantime. 
John
Posted on: 12 Dec 2014 16:08
I get the follwoing console error, "Uncaught TypeError: Cannot read property 'prototype' of undefined" when trying to apply the fix for Treeview. How do I fix this?
Chad
Posted on: 10 Dec 2014 13:40
Is this fixed in the latest 1118 patch release? There aren't any notes directly referring to this.
SHERFUDEEN
Posted on: 09 Dec 2014 06:14
Hi Hristo Valyavicharski,
I am also getting the same issue. Thanks for the workaround. I added the Javascript to my application for listbox. But I am getting the error "Uncaught TypeError: Cannot read property 'prototype' of undefined ".

I changed the code as

 $(Telerik.Web.UI.RadListBox).prototype.saveClientState =funtion(){
// code
}
Now I am getting
" Uncaught TypeError: Cannot set property 'saveClientState' of undefined  (anonymous function)" Error
  How can I solve this?
Okami
Posted on: 04 Dec 2014 18:27
Has anyone been able to determine if zoom is always the issue? I've talked to a few customers and it seems it doesn't always fix it.
Okami
Posted on: 03 Dec 2014 20:22
Thanks Adrian. I got it to reproduce! 
Adrian Pope
Posted on: 03 Dec 2014 19:07
Use chrome, I was able replicate using a list box with enough items to cause a scroll.  If you zoom out or in and then scroll down and cause a post back you should get the error.
Okami
Posted on: 03 Dec 2014 18:26
Can we get a little more detail on the issue? I have not been able to reproduce the issue with scrolling and zooming but a lot of our customers are seeing it in the app
Keith
Posted on: 02 Dec 2014 21:05
I have the this issue with the RadTreeView, when I put in the script I get an error: Telerik is not defined.
ADMIN
Hristo Valyavicharski
Posted on: 01 Dec 2014 12:55
Workaround for 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>	
ADMIN
Hristo Valyavicharski
Posted on: 01 Dec 2014 12:48
Workaround for 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>
ADMIN
Hristo Valyavicharski
Posted on: 01 Dec 2014 12:44
Workaround for 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>
Robert
Posted on: 01 Dec 2014 09:49
Figured out what's going on by looking at the postback logs.

Chrome has started setting the scroll position as a floating point rather than an integer. RadListBox is not flooring this value before posting it back (or just parsing it as a double) which is causing a parsing exception on the server.

E.g. here's an example ClientState hidden field value after scrolling:

{"isEnabled":true,"logEntries":[{"Type":5,"Index":"12","Data":{"NewIndex":"17"}},{"Type":5,"Index":"18","Data":{"NewIndex":"9"}}],"selectedIndices":[],"checkedIndices":[12,18],"scrollPosition":36.6667}

That 36.6667 is the problem. I've worked around it by handling the RadListBox scroll event and flooring out the value before it's posted back:

$(".RadListBoxScrollable .rlbGroup").off("scroll.position-fix").on("scroll.position-fix", function () {

    $(this).scrollTop(Math.floor($(this).scrollTop()));
});

I should stress I'm not 100% if this will fix it yet, I'm awaiting user feedback as I can't reproduce it myself! But I'm pretty sure it will fix the problem as the issue is clearly that the RadListBox attempts to do an int.Parse() on a floating point on postback.
Robert
Posted on: 01 Dec 2014 08:36
Please can you post a workaround for this? Reverting to 100% zoom doesn't work.

I'm getting more reports of this from users and there doesn't seem to be anything I can do about it!
Robert
Posted on: 28 Nov 2014 08:51
Thanks for the update.

Is there a way I can work around this in the meantime? I have a couple of users who are experiencing the issue though I'm unable to reproduce it (even in Chrome zoomed in/out).
Elena
Posted on: 27 Nov 2014 14:36
The fix will be available in Q3 2014 SP1, expected in the beginning of December.
ADMIN
Hristo Valyavicharski
Posted on: 26 Nov 2014 13:22
Affected Controls: RadScheduler, RadListBox, RadTreeView