Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > itemdatabound error

Reply
Thread Tools

itemdatabound error

 
 
pmuruga@gmail.com
Guest
Posts: n/a
 
      09-22-2006
Hi,
I am a newbie using the datagrid. I got a code snippet from
gotdotnet. I have a edit command column and 3 bound column. when i try
to edit the record i get an error.

Sub MyDataGrid_ItemDataBound(ByVal Sender As Object, ByVal E As
DataGridItemEventArgs)
If (E.Item.ItemType = ListItemType.EditItem) Then
Dim i As Integer
For i = 0 To E.Item.Controls.Count - 1
If (E.Item.Controls(i).Controls(0).GetType().ToString ()
= "System.Web.UI.WebControls.TextBox") Then
Dim tb As TextBox
tb = E.Item.Controls(i).Controls(0)
tb.Text = Server.HtmlDecode(tb.Text)
End If
Next
End If
End Sub

when the count goes to 1 and greater I get specified argument was out
of range. I tried debugging and I can see that
E.Item.Controls(0).Controls(0).GetType().ToString( ) =
System.Web.UI.WebControls.Button
but E.Item.Controls(1).Controls(0).GetType().ToString( ) is throwing an
error.

Any help would be appreciated.

Thank you,
Muru

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ItemDataBound error: does not contain a definition for Joel Zinn ASP .Net Datagrid Control 0 09-14-2006 08:54 PM
inserting control in ItemDataBound Steve Klett ASP .Net 2 11-13-2003 05:39 PM
Re: ItemDataBound in Repeater: FYI René Paschold ASP .Net 2 10-16-2003 06:39 AM
ref dropdownlist in itemdatabound event? Tina ASP .Net 1 10-14-2003 06:33 PM
ItemDataBound not received by grid in table? James G. Beldock ASP .Net 0 07-24-2003 04:38 PM



Advertisments