I have a GridView. I have to collect the GridViewRow where checkbox is selected. How can I achieve it without any client side script? Please help me to get this done.
-
1Posting the code what you have so far would make things easy for the people who want to answer you question.Jude Cooray– Jude Cooray2010-10-23 16:24:04 +00:00Commented Oct 23, 2010 at 16:24
Add a comment
|
3 Answers
Simple and easy to understand when you come back to it later.
var selectedRows = (from GridViewRow row in GridView1.Rows
let cbx = (CheckBox)row.FindControl("CheckBox1")
where cbx.Checked
select row).ToList();
Bare in mind that for this to work I think you'll need to convert the column containing the checkbox into a template column.