Any body knows how can we access checkbox inside the gridview(means i need the id of those check box whose checked property is true.)?
Any body knows how can we access checkbox inside the gridview(means i need the id of those check box whose checked property is true.)?
Answers
Add AnswerBy an anonymous user on Jun. 20, 2008
Try this:
Dim row As GridViewRow = CType(CType(e.CommandSource, Control).Parent.Parent, GridViewRow)
Dim chkBox As checkbox = CType(row.FindControl("yourCheckBoxControl"), checkbox)
This should give you access to your control.
By an anonymous user on Jun. 20, 2008
Try doing something like this:
Dim r As GridViewRow
For Each r In grd.Rows
Dim chkBox As CheckBox = CType(r.Cells(0).Controls(1), CheckBox)
Next
You may have to play around with the index inside the control property depending on wether or not you have any other controls in that column.
where to write this code.
Share your knowledge