Have you stepped through it to find out why it not working. I see one thing off the top that I know has frustrated me time and time again is that the find control method does not recursively search for controls and does not find controls that are not a direct a child of the control your calling the method on. Since your working with check box i am assuming its a templated gv so you might check to see if you are actually finding the check box during execution. If your not then write a recursive search for control.
Code:
public Control FindControl( Control cntrl, string controlID )
{
Control rVal = null;
if( cntrl.ID == controlID )
rVal = cntrl;
else
{
// we do the recursive depth search on all child control until we find it
foreach( var c in cntrl.Controls )
{
rVal = FindControlRecursive( cntrl, controlID );
if( rVal != null )
break; // found quit looking
}
}
return rVal;
}
I also notice that you try to find a drop down for the current row that was bound, and then iterate through the entire gv looking at each row for a check box, toggling the current bound rows drop down on and off. Is this what you intended or did you intend on enabling the current rows drop down base on what that rows check box was?
You can do this with the recursive search defined above
Code:
var ddl = FindControl(e.Row,"DDL");
var chbx = FindControl(e.Row,"chkSelect");
ddl.Enabled = chkbx.Checked;