Question Details

Browse

Help regarding asp.net 2.0

By Jibi - Jun. 19, 2008

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 Answer
  1. By 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.


    0 Votes
  2. 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.


    0 Votes
  3. By Jibi on Jun. 21, 2008

    where to write this code.


    0 Votes
Share your knowledge

Related Questions

Browse Get answers and share your expertise.