Multiple GridTableView inside NestedViewTemplate

8 posts, 0 answers
  1. krishna
    krishna avatar
    7 posts
    Member since:
    Apr 2016

    Posted 02 Jun Link to this post

    I am trying to use multiple GridViewTable inside NestedViewTemplate with different data sources. It displays only one at a time and ignores other. is there any way to display them both?
  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 07 Jun Link to this post

    Hi Krishna,

    In case you are using a NestedViewTemplate and you want to add TableViews in it you can add RadGrid controls in it. Otherwise you can use multiple GridTableView and NestedTableViews on the same level as follow.
    <MasterTableView >
        <NestedViewTemplate>
            <telerik:RadGrid ID="InnerRadGrid">
            </telerik:RadGrid>
        </NestedViewTemplate>
        <DetailTables>
            <telerik:GridTableView Name="FirstTableView">
            </telerik:GridTableView>
            <telerik:GridTableView Name="SecondTableView">
            </telerik:GridTableView>
        </DetailTables>

    I hope this information helps.


    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. krishna
    krishna avatar
    7 posts
    Member since:
    Apr 2016

    Posted 07 Jun in reply to Kostadin Link to this post

    When I use both <NestedViewTemplate> and <Detail Tables>, it ignores one and displays data from only <NestedViewTemplate>.
  5. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 10 Jun Link to this post

    Hi Krishna,

    Please excuse me for misleading you in my previous reply. You are correct you can not use NestedViewTemplate and detail GridTableView on a same level. Nevertheless, you can either use multiple GridTableView or use single NestedViewTemplate with multiple RadGrid controls in it. This way you can achieve your requirement.

    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.
  6. krishna
    krishna avatar
    7 posts
    Member since:
    Apr 2016

    Posted 10 Jun in reply to Kostadin Link to this post

    I tried below, but it displays data from only first <div> (--Details from parent data source), not from other two GridTableView

     </NestedViewTemplate>
                       <div>
                           <table >
                               -- Details from parent data source
                           </table>
                           
                        </div>
                        <telerik:GridTableView Datasourceid="TestA">
                               
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="" MasterKeyField="" />
                            </ParentTableRelation>
                            <Columns>
                                -- Details  from TestA datasource                       
                            </Columns>
                        </telerik:GridTableView>
                                       
                        <telerik:GridTableView DataSourceID ="TestB" >

                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="AssetId" MasterKeyField="AssetId" />
                            </ParentTableRelation>
                           
                            <Columns >
         -- Details  from TestB datasource         
       </Columns>
                        </telerik:GridTableView>
     </NestedViewTemplate>

  7. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 15 Jun Link to this post

    Hi Krishna,

    Note that you need to use a RadGrid control and not GridTableView. Please check out the following live example which demonstrates a similar scenario.

    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.
  8. krishna
    krishna avatar
    7 posts
    Member since:
    Apr 2016

    Posted 15 Jun in reply to Kostadin Link to this post

    That doesn't work either. as soon as you put <ParentTableRelation> , it doesn't display data from grid

                        </telerik:RadGrid> 
                            <MasterTableView>
                                <ParentTableRelation>
                                    <telerik:GridRelationFields DetailKeyField="" MasterKeyField="" />
                                </ParentTableRelation>

                                <Columns>
                                    <telerik:GridTemplateColumn HeaderText="">
                                        <ItemTemplate>
                                            <table>
                                                <tr>
                                                    <td><%# Eval("Name").ToString()%></td>
                                                   
                                                </tr>
                                            </table>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>

                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid> 

  9. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 20 Jun Link to this post

    Hello Krishna,

    Note that ParentTableRelation is applicable only when using a DetailTables. In case you are using a NestedViewTemplate you can get the ID of the parent dataitem and based on it to retrieve the data. If you examine the previously provided live example you will noticed that we are using a Label control which holds the EmployeeID of each parent row. Based on the id we filter the datasource and populate the child RadGrid. You can use similar approach for your project.

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017