Add column for select a row

2 posts, 0 answers
  1. Brygom
    Brygom avatar
    15 posts
    Member since:
    May 2009

    Posted 13 Jun 2009 Link to this post

    Hi! I need add a column for select the row, I'm tried add the column with this code:

         <telerik:GridButtonColumn CommandName="Select" Text="Select"  
             UniqueName="column" > 

    In code behind I have this:
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
         foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items) 
             dataItem.Selected = true
    My problem is, always select the first row on the page in the grid.

    I hope for your help.

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Jun 2009 Link to this post

    Hi Brygom,

    Try the following code snippet to select the item on clicking the select button in that row:

     protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
                if (e.CommandName == "Select"
                    e.Item.Selected = true

Back to Top