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

Programmatically Created/Populated Detail View - Expand/Collapse column disappearing after postbacks

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 24 Mar 2016, 04:04 PM

I have a grid in which I am creating and populating a nested detail view using a private class (DetailTemplate) which inherits from ITemplate. The detail view is populated with controls in the InstantiiateIn method of the DetailTemplate class.

In Page_Init, I create a new instance of DetailTemplate and assign it to master.MasterTableView.NestedViewTemplate where master is the main grid and parent of the nested detail view.

The first time the page is browsed, the page renders as expected with an Expand/Collapse column in the master grid and expanding/collapsing any of the master grid's rows works as expected.

After postbacks which result in the master grid being rebound, the Expand/Collapse column of the master grid disappears. I'm guessing I'm missing assigning a new instance of DetailTemplate to master.MasterTableView.NestedViewTemplate somewhere when the master grid gets rebound. What am I missing?

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 29 Mar 2016, 06:48 AM
Hello Doug,

Could you please provide your code declaration in order to examine it locally. Meanwhile you can check out the following help article which elaborates more on creating a templates programmatically. The topic describes how to add a GridTemplateColumn but the approach is the same for NestedViewTemplate.

Regards,
Kostadin
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Grid
Asked by
Doug
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or