Search code examples
winformstelerikhierarchyradgrid

Telerik winforms how get selected row > ID column value > In hierarchy > Templates[0]


I want to get Telerik winforms selected row > ID column value > First Column > In hierarchy > Templates[0] < This is my child template.

For the master template we can act like this :

Selected_ID_Main_Person = int.Parse(Grid_PhoneBook.CurrentRow.Cells["ID"].Value.ToString());

But what about child template?
I tried this with no help :

 this.Grid_PhoneBook.MasterTemplate.Templates[0].CurrentColumn???????????

Edit :
This code returns selected column index :

this.Grid_PhoneBook.MasterTemplate.Templates[0].CurrentColumn.Index

But how can i get it's value? (Also i need first column of selected row's value)


Solution

  • The Grid_PhoneBook.CurrentRow property will always return the current row in RadGridView, no matter in which template it resides, so you can rely on this property only.

    To check if the current row is from master or child template, you can refer to its ViewTemplate property.