This is a migrated thread and some comments may be shown as answers.
SelectionChanged event in hierarchial RadGridView
2 Answers 5 Views
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
Veteran
James asked on 31 Dec 2020, 04:51 PM

For a SelectionChanged event in a hierarchical RadGridView, how do I test to determine which template had a row selection change?

2 Answers, 1 is accepted

Sort by
0
Nadya
Telerik team
answered on 04 Jan 2021, 02:46 PM

Hello, James,

In order to know whether the SelectionChanged event is triggered by the master template or by a child template, you can check whether the Parent property of the corresponding GridViewTemplate is null. This will ensure that the row is from the master template. Please refer to the following code snippet:

 private void RadGridView1_SelectionChanged(object sender, EventArgs e)
 {
     var selectedRow = this.radGridView1.SelectedRows[0];
     bool isMaster = (selectedRow.ViewTemplate.Parent == null);
     if (isMaster)
     {
         Console.WriteLine("Master");
     }
     else
     {
         Console.WriteLine("Template");
     }
 }

I hope this helps. Let me know if you have other questions. 

Regards,
Nadya
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
James
Top achievements
Rank 1
Veteran
answered on 04 Jan 2021, 03:09 PM
This helps a bunch. Thanks Nadya.
Asked by
James
Top achievements
Rank 1
Veteran
Answers by
Nadya
Telerik team
James
Top achievements
Rank 1
Veteran
Share this question
or