Exception with CheckboxList control

Discussion in 'ASP .Net' started by KN, Nov 25, 2007.

  1. KN

    KN Guest

    I am getting the following exception in a page while using the Checkboxlist
    control. This happens on postback.

    startIndex cannot be larger than length of string.
    Parameter name: startIndex
    Description: An unhandled exception occurred during the execution of the
    current web request. Please review the stack trace for more information about
    the error and where it originated in the code.

    Exception Details: System.ArgumentOutOfRangeException: startIndex cannot be
    larger than length of string.
    Parameter name: startIndex

    Source Error:

    An unhandled exception was generated during the execution of the current web
    request. Information regarding the origin and location of the exception can
    be identified using the exception stack trace below.

    Stack Trace:


    [ArgumentOutOfRangeException: startIndex cannot be larger than length of
    string.
    Parameter name: startIndex]
    System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length,
    Boolean fAlwaysCopy) +2916027
    System.Web.UI.WebControls.CheckBoxList.LoadPostData(String postDataKey,
    NameValueCollection postCollection) +54

    System.Web.UI.WebControls.CheckBoxList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11
    System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean
    fBeforeLoad) +353
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194


    The page itself is a content page and page is a subclass of a base web page.
    At this point the checkboxlist does not have any items added to it. It
    renders fine the first time the page comes up. But the exception is thrown
    during postback.

    Any help appreciated.
     
    KN, Nov 25, 2007
    #1
    1. Advertising

  2. KN

    Carl Clement Guest

    We hit this error today. We have been using JQuery to re-write the list item name attribute to all be the same so we could validate that one had been checked. ASP.Net appears to dislike this and generated the stack trace:


    [ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
    Parameter name: startIndex]
    System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +7492915
    System.Web.UI.WebControls.CheckBoxList.LoadPostData(String postDataKey, NameValueCollection postCollection) +60
    System.Web.UI.WebControls.CheckBoxList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +13
    System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +346
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743



    Once we disabled the JQuery call to change the CheckBox List, ListItem name attribute the error went away.

    > On Sunday, November 25, 2007 11:06 AM K wrote:


    > I am getting the following exception in a page while using the Checkboxlist
    > control. This happens on postback.
    >
    > startIndex cannot be larger than length of string.
    > Parameter name: startIndex
    > Description: An unhandled exception occurred during the execution of the
    > current web request. Please review the stack trace for more information about
    > the error and where it originated in the code.
    >
    > Exception Details: System.ArgumentOutOfRangeException: startIndex cannot be
    > larger than length of string.
    > Parameter name: startIndex
    >
    > Source Error:
    >
    > An unhandled exception was generated during the execution of the current web
    > request. Information regarding the origin and location of the exception can
    > be identified using the exception stack trace below.
    >
    > Stack Trace:
    >
    >
    > [ArgumentOutOfRangeException: startIndex cannot be larger than length of
    > string.
    > Parameter name: startIndex]
    > System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length,
    > Boolean fAlwaysCopy) +2916027
    > System.Web.UI.WebControls.CheckBoxList.LoadPostData(String postDataKey,
    > NameValueCollection postCollection) +54
    >
    > System.Web.UI.WebControls.CheckBoxList.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +11
    > System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean
    > fBeforeLoad) +353
    > System.Web.UI.Page.ProcessRequestMain(Boolean
    > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1194
    >
    >
    > The page itself is a content page and page is a subclass of a base web page.
    > At this point the checkboxlist does not have any items added to it. It
    > renders fine the first time the page comes up. But the exception is thrown
    > during postback.
    >
    > Any help appreciated.



    > Submitted via EggHeadCafe
    > Serializing Excel data for input to any Google visualization
    > http://www.eggheadcafe.com/tutorial...ta-for-input-to-any-google-visualization.aspx
     
    Carl Clement, Mar 2, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Francois Verbeeck
    Replies:
    0
    Views:
    1,896
    Francois Verbeeck
    Jun 24, 2003
  2. JD
    Replies:
    5
    Views:
    11,721
    NetArchitect
    Aug 8, 2007
  3. =?Utf-8?B?SSBhbSBTYW0=?=

    CheckBoxList Control nullReferance Exception

    =?Utf-8?B?SSBhbSBTYW0=?=, Mar 23, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,875
    =?Utf-8?B?SSBhbSBTYW0=?=
    Mar 24, 2005
  4. Patrick.O.Ige
    Replies:
    5
    Views:
    19,171
    Patrick.O.Ige
    Jun 19, 2005
  5. Replies:
    0
    Views:
    3,866
Loading...

Share This Page