开发者

ASP.NET Javascript Error :: sys.webforms.pagerequestmanagerservererrorexception

I have an ASP.NET site that uses JQuery and ASP.NET Upda开发者_Go百科tePanel 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>


I have had this very same issue and finally solved it by removing all the AJAX controls until i had a basic form with no UpdatePanel (this hides the true server side error that is going on). Turns out then the error was pure c# issue in the code behind.


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 index and length parameter. It looks like some sort of string manipulation call, and the value of length is either negative or larger than the length of the string you're working on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜