how to select a RadGridView.ChildRows row that contains a cell with a certain value

3 posts, 0 answers
  1. fabrizio
    fabrizio avatar
    14 posts
    Member since:
    Aug 2010

    Posted 20 May 2019 Link to this post

    Hi everyone
    I have to select a row in a winform radGridView after I made an update on that row in a sorted column and use the value of a cell in an ID column (column 0) as an index.
    Can anyone please give me some help?
    thanks a lot
    Fabrizio
  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3754 posts

    Posted 20 May 2019 Link to this post

    Hello, Fabrizio,     

    In order to select a specific row, you can iterate the rows in RadGridView, check the respective cell's value that you are looking for and set the GridViewRowInfo.IsSelected property to true:

    private void radButton1_Click(object sender, EventArgs e)
    {
        foreach (GridViewRowInfo r in this.radGridView1.ChildRows)
        {
            if ((int)r.Cells["ProductID"].Value == 21)
            {
                r.IsSelected = true;
                this.radGridView1.TableElement.ScrollToRow(r);
            }
        }
    }

    The following help article are quite useful about the child rows in RadGridView and selecting rows programmatically:

    https://docs.telerik.com/devtools/winforms/controls/gridview/rows/rows-vs-childrows
    https://docs.telerik.com/devtools/winforms/controls/gridview/selection/selecting-rows-and-cells-programmatically

    Note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread. Thank you for your understanding.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. fabrizio
    fabrizio avatar
    14 posts
    Member since:
    Aug 2010

    Posted 20 May 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    thank you so much Dess you are always the best

    Fabrizio

Back to Top