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

RadGridView hierarchy force RowSourceNeeded event always

1 Answer 285 Views
GridView
This is a migrated thread and some comments may be shown as answers.
ahmed
Top achievements
Rank 1
ahmed asked on 11 Apr 2016, 09:29 AM

Hello there , 

i have RadGridView hierarchy with 3 level

i want to do the following

1- when expand any row at the first level , i need to collapse any other expanded row.

2-  when expand any row at the first level i need to dispose any data source assigned to other rows , in other words i want to keep my memory to contain only the datasource of current expanded row.

for example

i expanded first row , then rowsourceneed event will be fired and second level will be binded

when expand second row , also rowsourceneed event will be fired and second level will be binded 

now i need to clear the datasource for first expanded row , and when first row expanded again it will force rowsourceneed event to be fired again

please help me.

regards,

Ahmed.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Apr 2016, 12:02 PM
Hello Ahmed,

Thank you for writing.

You can use the RadGridView.ChildViewExpanded event to detect when a row is expanded. However, note that when using load on demand approach, the RowSourceNeeded event is fired once for a certain parent row and the child rows collection is internally stored in RadGridView. Expanding the same parent row for the second time won't trigger this event. This is the designed mechanism for on demand hierarchy.

I think that it would be more suitable to use RadVirtualGrid, where the whole data is populated by using the CellValueNeeded event. Additional information is available at the following link:
http://docs.telerik.com/devtools/winforms/virtualgrid/hierarchical-virtual-grid/hierarchical-data

I hope this information helps. Should you have further questions I would be glad to help.

 Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
ahmed
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or