Client Access:
Function Findcheckbox ()
{
// Get target base & Child control.
VaR Targetbasecontrol = Document. getelementbyid ( ' <% = Gridview1.clientid %> ' );
VaR Targetchildcontrol = " Chkbox1 " ;
// Get all the control of the type input in the base control.
VaR Inputs = Targetbasecontrol. getelementsbytagname ( " Input " );
// Checked/unchecked all the checkboxes in side the gridview.
For ( VaR N = 0 ; N < Inputs. length; ++ N)
{
If (Inputs [N]. Type = ' Checkbox ' && Inputs [N]. Id. indexof (targetchildcontrol, 0 ) > = 0 )
{
//Write your code here
Alert ("I found check box:" +Inputs [N]. ID );
}
}
}
Server access (checkbox in the template column)
Public Object Checkvaliddel ()
{
Int I;
Bool Valid = False ;
For (I = 0 ; I <= Dgdata. Items. Count - 1 ; I ++ ) {
Datagriditem dgitem = Dgdata. Items (I );
Checkbox CHB = (Checkbox) dgitem. findcontrol ( " Chk1 " );
If (CHB ! = Null ) & CHB. Checked) {
Valid= True;
ReturnValid;
}
}
}