I am getting the error on textbox with Ajax Control Toolkit calendar extender, I am using Microsoft Edge, IE11, Chrome:
Uncaught Sys.ArgumentOutOfRangeException: Sys.ArgumentOutOfRangeException: Value must be an integer. Parameter name: y
The textbox whether populated or not on form load gets this error.
Here's the client side code
Remodel Date<br /><br />
<asp:TextBox ID="txtbxRemodelDate" runat="server" CssClass="detailscreenwidthstyle1"></asp:TextBox>
<asp:RegularExpressionValidator ID="txtbxStartDateRegularExpressionValidator" runat="server"
ControlToValidate="txtbxRemodelDate" Display="Dynamic" ErrorMessage="</br>*Date must be a valid date"
ValidationExpression="([1-9]|1[012])/([1-9]|[12][0-9]|3[01])/(19|20)\d\d"></asp:RegularExpressionValidator>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server"
CssClass="blueCalendar" TargetControlID="txtbxRemodelDate"></cc1:CalendarExtender>
Here's the complete error
Uncaught Sys.ArgumentOutOfRangeException: Sys.ArgumentOutOfRangeException: Value must be an integer. Parameter name: y Actual value was 625.5757446289062. at Function.Error$create [as create] (http://localhost/ScriptResource.axd?d=N9v-ex4jLgM8lHFu-PPLr2Aehppm2kCvkWv-sT6x6bMHJlxsZJOQTws_pzPtAPh87KkT1s87GA2MC3sHg242UGoTeK7AnwWYZ8KDIobeAa5Q7ArWAJqVtXJAaHQ_aXoSGb23JA2&t=ffffffffdd783992:847:15) at Function.Error$argumentOutOfRange [as argumentOutOfRange] (http://localhost/ScriptResource.axd?d=N9v-ex4jLgM8lHFu-PPLr2Aehppm2kCvkWv-sT6x6bMHJlxsZJOQTws_pzPtAPh87KkT1s87GA2MC3sHg242UGoTeK7AnwWYZ8KDIobeAa5Q7ArWAJqVtXJAaHQ_aXoSGb23JA2&t=ffffffffdd783992:908:21) at Function$_validateParameterType [as _validateParameterType] (http://localhost/ScriptResource.axd?d=N9v-ex4jLgM8lHFu-PPLr2Aehppm2kCvkWv-sT6x6bMHJlxsZJOQTws_pzPtAPh87KkT1s87GA2MC3sHg242UGoTeK7AnwWYZ8KDIobeAa5Q7ArWAJqVtXJAaHQ_aXoSGb23JA2&t=ffffffffdd783992:802:23) at Function$_validateParameter [as _validateParameter] (http://localhost/ScriptResource.axd?d=N9v-ex4jLgM8lHFu-PPLr2Aehppm2kCvkWv-sT6x6bMHJlxsZJOQTws_pzPtAPh87KkT1s87GA2MC3sHg242UGoTeK7AnwWYZ8KDIobeAa5Q7ArWAJqVtXJAaHQ_aXoSGb23JA2&t=ffffffffdd783992:719:18) at Function$_validateParams [as _validateParams] (http://localhost/ScriptResource.axd?d=N9v-ex4jLgM8lHFu-PPLr2Aehppm2kCvkWv-sT6x6bMHJlxsZJOQTws_pzPtAPh87KkT1s87GA2MC3sHg242UGoTeK7AnwWYZ8KDIobeAa5Q7ArWAJqVtXJAaHQ_aXoSGb23JA2&t=ffffffffdd783992:668:22) at new Point (http://localhost/ScriptResource.axd?d=N9v-ex4jLgM8lHFu-PPLr2Aehppm2kCvkWv-sT6x6bMHJlxsZJOQTws_pzPtAPh87KkT1s87GA2MC3sHg242UGoTeK7AnwWYZ8KDIobeAa5Q7ArWAJqVtXJAaHQ_aXoSGb23JA2&t=ffffffffdd783992:4739:22) at Function.DomElement$getLocation [as getLocation] (http://localhost/ScriptResource.axd?d=N9v-ex4jLgM8lHFu-PPLr2Aehppm2kCvkWv-sT6x6bMHJlxsZJOQTws_pzPtAPh87KkT1s87GA2MC3sHg242UGoTeK7AnwWYZ8KDIobeAa5Q7ArWAJqVtXJAaHQ_aXoSGb23JA2&t=ffffffffdd783992:5195:16) at Function.DomElement$getBounds [as getBounds] (http://localhost/ScriptResource.axd?d=N9v-ex4jLgM8lHFu-PPLr2Aehppm2kCvkWv-sT6x6bMHJlxsZJOQTws_pzPtAPh87KkT1s87GA2MC3sHg242UGoTeK7AnwWYZ8KDIobeAa5Q7ArWAJqVtXJAaHQ_aXoSGb23JA2&t=ffffffffdd783992:5126:36) at Sys.Extended.UI._CommonToolkitScripts.getBounds (http://localhost/facilities/facilitiesrenovation.aspx?TSM_HiddenField=ctl00_smScriptManager_HiddenField&TSM_CombinedScripts=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.51116.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3a07ead49c-3169-4e2b-b447-bacc452e967a%3ade1feab2%3afcf0e993%3af2c8e708%3a720a52bf%3af9cec9bc%3a589eaa30%3a698129cf%3afb9b4c57%3accb96cf9:3:3108) at Sys.Extended.UI.PopupBehavior.getBounds (http://localhost/facilities/facilitiesrenovation.aspx?TSM_HiddenField=ctl00_smScriptManager_HiddenField&TSM_CombinedScripts=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.51116.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3a07ead49c-3169-4e2b-b447-bacc452e967a%3ade1feab2%3afcf0e993%3af2c8e708%3a720a52bf%3af9cec9bc%3a589eaa30%3a698129cf%3afb9b4c57%3accb96cf9:29:1919)
I tried the below suggestions but nothing worked.
https://www.telerik.com/forums/sys-argumentoutofrangeexception-value-must-be-an-integer-ba4368c85de9
https://forums.asp.net/t/1620879.aspx
There's a suggestion that recommends modifying the MicrosoftAjax.js, but I do not have that file.
I got same problem and isolated it using AjaxControlToolkit Version: 4.5.7.429,
Problem happens since this old library calculates one of the related elements offset (location) using body scrolltop, and this latest returns a float value.
https://github.com/jquery/api.jquery.com/issues/608 Jquery ScrollTop animation issue
Related code in the Old library:
$type = Sys.UI.Point = function Point(x, y) {
/// <summary locid="M:J#Sys.UI.Point.#ctor"></summary>
/// <param name="x" type="Number" integer="true"></param>
/// <param name="y" type="Number" integer="true"></param>
/// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Point.x"></field>
/// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Point.y"></field>
var e = Function._validateParams(arguments, [
{name: "x", type: Number, integer: true},
{name: "y", type: Number, integer: true}
]);
if (e) throw e;
this.x = x;
this.y = y;
}
function DomElement$getLocation(element)
var ex, ownerDoc = element.ownerDocument, documentElement = ownerDoc.documentElement,
offsetX = Math.round(clientRect.left) + (documentElement.scrollLeft || (ownerDoc.body ? ownerDoc.body.scrollLeft : 0)),
offsetY = Math.round(clientRect.top) + (documentElement.scrollTop || (ownerDoc.body ? ownerDoc.body.scrollTop : 0));
...
return new Sys.UI.Point(offsetX, offsetY);
Tried a lot of workarounds to round value, but since this toolkit is provided as dll, is not possible to inject some script additional logic.
My fix is basically migrate to a latest AjaxControlToolkit (20.1.0.0), I tested this new library with the same environment where I isolated the problem, and this latest version already fixed the float problem.
related code in the updated library:
Sys.UI.Point = function Sys$UI$Point(x, y) {
/// <summary locid="M:J#Sys.UI.Point.#ctor" />
/// <param name="x" type="Number"></param>
/// <param name="y" type="Number"></param>
/// <field name="x" type="Number" integer="true" locid="F:J#Sys.UI.Point.x"></field>
/// <field name="y" type="Number" integer="true" locid="F:J#Sys.UI.Point.y"></field>
/// <field name="rawX" type="Number" locid="F:J#Sys.UI.Point.rawX"></field>
/// <field name="rawY" type="Number" locid="F:J#Sys.UI.Point.rawY"></field>
var e = Function._validateParams(arguments, [
{name: "x", type: Number},
{name: "y", type: Number}
]);
if (e) throw e;
this.rawX = x;
this.rawY = y;
this.x = Math.round(x);
this.y = Math.round(y);
}