Hi, To test the code do as below : Try to change the btnDelete_Click as below and check the label.
Sub btnDelete_Click(sender As Object, e As EventArgs)
Dim item As DataGridItem
For Each item In DataGrid1.Items
Label1.Text &= "
" & item.Cells(1).Text
Next item
End Sub
OR Use DataGrid1.Items.Count to check the number of items in the datagrid
Shaji
Contributor
7101 Points
1412 Posts
Re: unable to iterate through the datagriditems collection
Aug 26, 2003 07:35 PM|LINK
Sub btnDelete_Click(sender As Object, e As EventArgs) Dim item As DataGridItem For Each item In DataGrid1.Items Label1.Text &= " " & item.Cells(1).Text Next item End SubOR Use DataGrid1.Items.Count to check the number of items in the datagrid