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

RadGrid with GridClientSelectColumn

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amitkumar
Top achievements
Rank 1
Amitkumar asked on 01 Dec 2009, 04:20 AM
Hell Friends,

I am usig RadGrid with GridClientSelectColumn mention below:
<telerik:GridClientSelectColumn UniqueName="SelectColumn" />

when loading a page that time i would like to select all row with that column checkbox should be checked, and i am using following code, but it will not work, what was the wrong with that code, reply me.

if (e.Item.ItemType == GridItemType.Item)
            {
                GridDataItem item = (GridDataItem)e.Item;
                CheckBox checkBox = (CheckBox)item["SelectColumn"].Controls[0];
                
                checkBox.Checked = true;
            }






1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 01 Dec 2009, 08:34 AM
Hi Amit,

You can simply set the Selected property for the data items to true rather than accessing the checkboxes for the GridClientSelectColumn and then setting it checked:
c#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)  
    {  
        if (e.Item is GridDataItem)  
        {  
            GridDataItem dataItem = (GridDataItem)e.Item;  
            dataItem.Selected = true;  
        }  
    }  

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