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

2 posts, 0 answers
  1. Doug
    Doug avatar
    1 posts
    Member since:
    Feb 2016

    Posted 24 Mar 2016 Link to this post

    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?

  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 29 Mar 2016 Link to this post

    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.

    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top