Exception with CheckboxList control

K

KN

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.
 
C

Carl Clement

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.
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top