Are you talking about the CheckBoxList control in gridview row then the solution is below:
foreach(GridViewRow gr in gridview1.Rows){
CheckBoxList cbx = (CheckBoxList) gr.FindControl(""); foreach(ListItem cbk in cbx.Items){ if(cbk.Selected){ // Do your work here } } }
Since CheckBoxList has multiple selection option, so you need for loop to get all the selection. SelectedItem property of list will give only first item.
Hi Vibhu, foreach (GridViewRow row in yourGridViewID.Rows) { CheckBox check = (CheckBox)row.FindControl("CheckBoxName"); if (check.Checked) { //Take Row information from each column (Cell) and display it } else { //Display in seperate area }
Brijendra GautamPosted Mar 21, 2014, 5:24 AM
Are you talking about the CheckBoxList control in gridview row then the solution is below:
foreach(GridViewRow gr in gridview1.Rows){
CheckBoxList cbx = (CheckBoxList) gr.FindControl("
foreach(ListItem cbk in cbx.Items){
if(cbk.Selected){
// Do your work here
}
}
}
Since CheckBoxList has multiple selection option, so you need for loop to get all the selection. SelectedItem property of list will give only first item.
Lakshmanan Sethu SankaranarayanPosted Mar 21, 2014, 5:01 AM