hi
i am displaying checkbox,id and name in datagrid.when user selects 2 or more checkboxes and clicks confirm button on the webpage i need those id's of checked rows.how do i get them.
Dim di As System.Web.UI.WebControls.DataGridItem
Dim cb As CheckBox
For Each di In DataGrid1.Items
cb = DirectCast(di.FindControl("CheckBox1"), CheckBox)
If cb.Checked Then
Response.Write(di.Cells(1).Text() & "<br>")
End If
Next
Note: I am assuming that the second column is ID and it is a BoundColumn. Also that the code will only work if the checkbox is a Web Control and not a Html Control (ie. '<asp:CheckBox...' instead of '<input type="checkbox"...'). Hope this helps.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.