Select or highlight a row in a radgrid

3 posts, 0 answers
  1. marina
    marina avatar
    4 posts
    Member since:
    May 2011

    Posted 08 Jun 2011 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Jun 2011 Link to this post

    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.
  3. Richard
    Richard avatar
    1 posts
    Member since:
    Sep 2012

    Posted 29 Dec 2016 in reply to Shinu Link to this post

    Good example.  Very helpful.  Thanks.
Back to Top