Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CheckBox in Datagrid Table

Status
Not open for further replies.

lehuong

Programmer
Sep 2, 2003
98
US
Hi,
I have the checkbox in my gridtable. How can I get the row number from the girdtable when the checkbox is checked? I can check to see if the checkbox is checked or not but I can not get the row number from the ones that have been checked. Hope you guys can help me out of this loop...
Thanks,
Huong
 

I use this script... hope can help u :)

Private Sub cmd_OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_OK.Click
Dim dg1 As DataGridItem
Dim chkPolis As CheckBox
Dim gvar_no as string

For Each dg1 In DataGrid1.Items
chkPolis = dg1.FindControl("chk_Polis")
'chk_Polis is checkbox's name in datagrid
If chkPolis.Checked Then
gvar_No = Trim(dg1.Cells(1).Text)
End If
Next
End Sub
 
Thank you for your help Verde! That is great! One more question, when I tried to load the data from database to the checkbox (true/false). (In the properties builder of the grid) It is not like the bound column, the template column does not have the "data field" for bind the true or false for the checkbox. So if I have a list of checked and unchecked then how can I bind these to the checkbox. Thanks :)
Huong
 
I don't know too, sorry :D
but i'll tell u if I get the code...
does anyone know?

thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top