NestedViewTemplate with Controls added programmatically while binding

4 posts, 0 answers
  1. Itye
    Itye avatar
    6 posts
    Member since:
    Jul 2011

    Posted 06 Jul 2011 Link to this post


    I have a simple RadGrid control.
    For each data item in the Datasource I create a User Control.
    The user control is determined at runtime according to the data-item (or data item id).
    I use LoadControl function to load the control.

    I want to add this control as a nested view template, so I can collapse/expand each row and edit the different controls.
    Once I finish editing the controls - (all in client side), I hit a save button to persist all the information to database.

    I will have to loop through the rows, get the user-control and execute a save function in it.

    What would be the best practice to achieve this?
    I started by adding NestedViewTemplate  with a container panel to hold the various user controls.
    This is how it looks like:
    <MasterTableView AutoGenerateColumns="False" DataKeyNames="Id"  GroupLoadMode="Client" HierarchyLoadMode="Client">
                        <asp:Panel runat="server" ID="configControlContainer" CssClass="viewWrap" Visible="true">

    Thank you,

  2. Mira
    Mira avatar
    1124 posts

    Posted 11 Jul 2011 Link to this post

    Hello Itye,

    In order to implement the desired functionality, I recommend that you load the usercontrols on ItemCreated and populate them with data on ItemDataBound. You can examine this help topic to see the major differences between ItemCreated and ItemDataBound events.

    Please check out the Traversing detail tables/items in Telerik RadGrid help topic to learn how to access the nested table views.

    I hope this helps.

    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. Trung Nguyen
    Trung Nguyen avatar
    14 posts
    Member since:
    Jul 2009

    Posted 02 Aug 2015 Link to this post

    same problem, help me :(
  4. Eyup
    Eyup avatar
    3935 posts

    Posted 06 Aug 2015 Link to this post

    Hello Trung,

    Could you elaborate on your requirement? What exactly is the problem you mentioned? Generally, you can examine the following live sample for implementing a NestedViewTemplate:

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top