I have a problem hope someone can help.
I have created a dynamic view which contains a gridview. This gridview contains a check box column in the Template Field with the help of ITemplate interface.
Now the prblm is I'm not able to access this check box . I am using
CheckBox chkSel = (CheckBox)gvRows.Cells[5].FindControl("ckh");
to find the check box but 'chkSel' is always returning null.This check box is in every row of the grid.
Depending on the checkbox selected it should perform some operations by a button click.
this is code which should be there in the button click.
Expand|Select|Wrap|Line Numbers
- foreach (View vw in TabMultiView.Views)
- {
- GridView gv = (GridView)vw.Controls[1];
- foreach (GridViewRow gvRows in gv.Rows)
- {
- CheckBox chkSel = (CheckBox)gvRows.Cells[5].FindControl("ckh");
- if (chkSel.Checked)
- {
- string chkStatus = "True";
- // some functions are done here..
- }
- }
- }