I have an ASP.NET site that uses JQuery and ASP.NET UpdatePanel and ScriptManager. On one page in particular, I get a javascript error:
sys.webforms.pagerequestmanagerservererrorexception: Index and length must refer to a location within the string. Parameter name:length
ScriptResourse.axd
Code: 0
Edit:
This error does not occur in my development environment, only when I publish the code to the test server.
Here’s what’s in the master page:
<asp:ScriptManager runat="server" ID="ScriptMgr"></asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="UpdatePanelMaster">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
In the page in question:
<asp:Content ID="ContentHeadEdit" ContentPlaceHolderID="ContentHeadMaster" Runat="Server">
<script type="text/javascript">
$(document).ready(function() {
$('#<%= ButtonSave.ClientID %>').button();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args) {
$('#<%= ButtonSave.ClientID %>').button();
}
});
</script>
</asp:Content>
This is an error in the server-side code. If you run debug (breaking on errors), you should get your line number. Alternatively, you could scan through your code-behind for a line of code that uses and
indexandlengthparameter. It looks like some sort of string manipulation call, and the value oflengthis either negative or larger than the length of the string you’re working on.