views:

18

answers:

0

Hi

I have a user control "SettingsControl" containing an ajax:CollapsiblePanelExtender which in turn has a GridView (gridView) and checkBoxes. On top of GridView we have two LinkButtons "Select All" and "Clear All". I have written to enable select all and clear all functionality. Select All should select all the rows in the grid by calling the following JavaScript written on the Client .aspx file.

function SelectAll(chk)
{    
    //get reference of GridView control
    var grid = document.getElementById('<%= SettingsControl1.FindControl("gridView").ClientID %>');
    //variable to contain the cell of the grid
    var cell;

    if (grid.rows.length > 0)
    {
        //loop starts from 1. rows[0] points to the header.
        for (i=1; i<grid.rows.length; i++)
        {
            //get the reference of first column
            cell = grid.rows[i].cells[0];

            //loop according to the number of childNodes in the cell
            for (j=0; j<cell.childNodes.length; j++)
            {           
                //if childNode type is CheckBox                 
                if (cell.childNodes[j].type =="checkbox" && cell.childNodes[j].id.indexOf('chkSel')!=-1)
                {
                //assign the status of the Select All checkbox to the cell checkbox within the grid
                    cell.childNodes[j].checked = chk;
                }
            }
        }
    }
}

I am not able to access the usercontrol or any element of user control on client side. I am not sure how to achive this functionality.

The .aspx page cal the user control as:

<uc1:SettingsControl ID="SettingsControl1" runat="server" />

PLEASE HELP!!!!