Followng code snippet shows how to loop thru datagrid
items (rows) to get control reference:
Dim ctrl As Control
For Each item As DataGridItem In datagrid.Items
ctrl = item.Cells(4).Controls(0) ' or try Controls(1)
depending on how to you add it
' If you assign ctrl ID, you can
ctrl = item.FindControl("ctrlID")
Dim ctrlType As String = item.Cells(2).Text
If ctrlType.Equals("Textbox") Then
Dim txtBox As TextBox = CType(ctrl, TextBox)
' Process as text box
Else
Dim ck As CheckBox = CType(ctrl, CheckBox)
' process as checkbox
End If
' Or you can dynamically find control type
If TypeOf ctrl Is TextBox Then
Dim txtBox As TextBox = CType(ctrl, TextBox)
' Process as text box
Else
Dim ck As CheckBox = CType(ctrl, CheckBox)
'process as checkbox
End If
Next
HTH
Elton Wang
>-----Original Message-----
>vb.net
>
>--
>Message posted via http://www.dotnetmonster.com
>.
>