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

Add column for select a row

1 Answer 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brygom
Top achievements
Rank 1
Brygom asked on 14 Jun 2009, 04:30 AM
Hi! I need add a column for select the row, I'm tried add the column with this code:

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

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.


1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Jun 2009, 03:58 AM
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
            } 
        } 


Thanks,
Princy
Tags
Grid
Asked by
Brygom
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or