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

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

2 Answers 872 Views
GridView
This is a migrated thread and some comments may be shown as answers.
fabrizio
Top achievements
Rank 1
Veteran
fabrizio asked on 20 May 2019, 11:36 AM
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 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 20 May 2019, 12:55 PM
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.
0
fabrizio
Top achievements
Rank 1
Veteran
answered on 20 May 2019, 02:46 PM

thank you so much Dess you are always the best

Fabrizio

Tags
GridView
Asked by
fabrizio
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
fabrizio
Top achievements
Rank 1
Veteran
Share this question
or