RadGrid with GridClientSelectColumn

2 posts, 1 answers
  1. Amitkumar
    Amitkumar avatar
    66 posts
    Member since:
    Aug 2009

    Posted 30 Nov 2009 Link to this post

    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;
                }






  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Dec 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top