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

Select or highlight a row in a radgrid

2 Answers 805 Views
Grid
This is a migrated thread and some comments may be shown as answers.
marina
Top achievements
Rank 1
marina asked on 08 Jun 2011, 02:29 PM
Hello,
I would like to select in a radgrid the row containing for a certain column a certain value. How do I do that having as input the value of one of the columns? I also wish that if the radgrid has multiple pages, that the result view is positioned correctly.

Thank you very much.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Jun 2011, 06:31 AM
Hello Marina,

If you want to select a row based on some cell value in RadGrid, try the following code snippet.

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
   {
       if (e.Item is GridDataItem)
       {
           GridDataItem item = (GridDataItem)e.Item;
           if (item["ColumnUniqueName"].Text == "Some value")//your condition
               item.Selected = true;
       }
   }

-Shinu.
0
Richard
Top achievements
Rank 1
answered on 29 Dec 2016, 01:22 PM
Good example.  Very helpful.  Thanks.
Tags
Grid
Asked by
marina
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Richard
Top achievements
Rank 1
Share this question
or