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

Multiple GridTableView inside NestedViewTemplate

7 Answers 297 Views
Grid
This is a migrated thread and some comments may be shown as answers.
krishna
Top achievements
Rank 1
krishna asked on 02 Jun 2016, 02:25 PM
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?

7 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 07 Jun 2016, 07:48 AM
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.
0
krishna
Top achievements
Rank 1
answered on 07 Jun 2016, 03:21 PM
When I use both <NestedViewTemplate> and <Detail Tables>, it ignores one and displays data from only <NestedViewTemplate>.
0
Kostadin
Telerik team
answered on 10 Jun 2016, 10:24 AM
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.
0
krishna
Top achievements
Rank 1
answered on 10 Jun 2016, 02:23 PM

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>

0
Kostadin
Telerik team
answered on 15 Jun 2016, 08:31 AM
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.
0
krishna
Top achievements
Rank 1
answered on 15 Jun 2016, 05:09 PM

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> 

0
Kostadin
Telerik team
answered on 20 Jun 2016, 10:21 AM
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.
Tags
Grid
Asked by
krishna
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
krishna
Top achievements
Rank 1
Share this question
or