This is a migrated thread and some comments may be shown as answers.

Get checkbox from header

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carlos Marchi
Top achievements
Rank 1
Carlos Marchi asked on 16 Jun 2010, 06:28 PM
Hi,

I've been problems in get checkbox from header of radgrid, and I dont know know to obtain this control. I need to access this control because When the user disable a check box from a row, then I need to access the checkbox all to set its checked property by false.

ex: checkboxSelectAll.checked = false;

Could Anybody help me, please?

Thak you for all attention,

Carlos

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Jun 2010, 06:08 AM
Hi Carlos,

I guess you are using following scenario.

aspx:
 
    <telerik:GridTemplateColumn UniqueName="CheckBox"
        <ItemTemplate> 
            <asp:CheckBox ID="ItemCheckBox" runat="server" /> 
        </ItemTemplate> 
        <HeaderTemplate> 
            <asp:CheckBox ID="HeaderCheckBox" runat="server" /> 
        </HeaderTemplate> 
    </telerik:GridTemplateColumn> 

If so, the code shown below will help you to access the checkbox placed in headeritem.
cs:
 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        GridHeaderItem headerItem = (GridHeaderItem)RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0]; 
        CheckBox headerCheckBox = (CheckBox)headerItem["CheckBox"].FindControl("HeaderCheckBox"); 
        headerCheckBox.Checked = true
    } 


-Shinu.
Tags
Grid
Asked by
Carlos Marchi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or