vb.net - Custom Checkbox list control Error in asp.net. "startIndex cannot be larger than length of string" -


I'm creating a custom checkbox control to add a div after each box in a checkboxlist. The class is down

Importing Systems Web. UI. WebControls Importing Systems Component MODEL Importing System Globilization Public Class Michekbox List Checkbox enforces checkboxeslink in the Inbox. IREAPT Infosource Protected Override Subordinate Item (ByVal Item Type List Type, By Behal Replate Index Integer, ByVal repeatInfo as RepeatInfo, ByVal Author HtmlTextWriter) Writer.WriteBeginTag (" as input ") writer.WriteAttribute (" type "," box ") writer.WriteAttribute (" name ", UniqueID) writer.WriteAttribute (" ID ", (ClientID & amp;" _ ") + repeatIndex.ToString ( NumberFormatInfo.Invariant Info)) writer.WriteAttribute ("value", item (repeatIndex) .Value) Dim attrs as System.Web.UI.AttributeCollection = item (repeatIndex). String (key in each key attrs.Keys writer.WriteAttribute, attrs (key)) Next attributes for as writer.Write ( "& gt;") writer.Write (item (repeatIndex) .text) 'writer .Write ( "& lt; div id =" & amp; "Manevdiv" & amp; before (repeat index). value and amp; "and Lat. / Div & gt;") end sub end class < / Pre>

But I get an error when I use it in a page and ask to save. The error is:

The starting index can not be longer than the string length. Parameter Name: startIndex Description: An uncontrolled exception occurred during the execution of the current web request. For more information about error and where this code has originated, review the stack trace

Exception Details:. System.ArgumentOutOfRangeException: STARTINDEX can not be larger than the string length. Parameter Name: startIndex

Source error:

An unrestricted exception occurred during the execution of existing web request. The information about the origin and location of the exception can be identified using the exception stack trace below.

Stack trace: <[p>

[Argumentofferation expansion: StartIDX can not be larger than string length. Parameter name: STARTINDEX] System.String.InternalSubStringWithChecks (Int32 STARTINDEX, Int32 length, Boolean fAlwaysCopy) 7,492,915 System.Web.UI.WebControls.CheckBoxList.LoadPostData (string postDataKey, NameValueCollection postCollection) +60

> System.Web.UI.WebControls.CheckBoxList.System.Web.UI.IPostBackDataHandler.LoadPostData (string Postdetake, Nammuly compilation Postcloleshn) +13
system. Web. UI. Page Prosespostdeta (Namviseshtya Postdeta, Boolean Fbiayrolod) +346
System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 1743

Any ideas?

"itemprop =" text ">

Place a breakpoint on your override renderItem function declaration. Start your project using VS debugging mode and what variables are set and what to find out I think you are starting somewhere on an empty string. Remember, arrays and such launches 0


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -