How to handle RadGrid’s Select Column Checkbox Event

 

Do these steps to handle the Radgrid’s select column checkbox event.

 

1. Allow row selection

 

<ClientSettings …>

<Selecting AllowRowSelect=”true” />

</ClientSettings>

 

 

2. Place the select column/row checkbox

<telerik:RadGrid …>

<ClientSettings …>…</ClientSettings>

<MasterTableView…>

 

<Columns>

<telerik:GridClientSelectColumn UniqueName=”Selectcol” HeaderText=”select”>

</telerik:GridClientSelectColumn>

</Columns>

</MasterTableView>

</<telerik:RadGrid>

 

3. Specify the ItemCreated Event

onitemcreated=”RadGrid_ItemCreated”

 

4. Define ItemCreated Event

protected void  RadGrid_ItemCreated(object sender, GridItemEventArgs e)

{

GridHeaderItem HeaderItem;

GridDataItem DateItem;

CheckBox chkbx=new CheckBox();

if (e.Item is GridHeaderItem)

{

HeaderItem = (GridHeaderItem)e.Item;

chkbx = (CheckBox)HeaderItem[“SelectCol”].Controls[0];

}

if (e.Item is GridDataItem)

{

DateItem = (GridDataItem)e.Item;

chkbx = (CheckBox)DateItem[“SelectCol”].Controls[0];

}

chkbx.AutoPostBack = true;

chkbx.CheckedChanged += new EventHandler(chkbx_CheckedChanged);

}

5. Define chkbx_CheckedChanged

 

void chkbx_CheckedChanged(object sender, EventArgs e)

{

}

 

Enjoy…:)