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

Displaying a list of n records inside a Grid nestedviewtemplate

1 Answer 259 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CoGG
Top achievements
Rank 1
CoGG asked on 20 Jun 2016, 06:53 AM

Please refer to the attached image of what i hope to achieve with using a radgrid, 

Basically I want to show a list of values underneath the details of the record i'm looking at.
my code is as follows: 

<telerik:RadGrid runat="server" DataSourceID="APPLICATIONS_DATASOURCE" ID="RADGRID1" OnDetailTableDataBind="MYMETHOD">
                <MasterTableView AutoGenerateColumns="false" DataKeyNames="DATA_ID">
                    <DetailTables>
                        <telerik:GridTableView Name="Contacts" DataKeyNames="CONTACT_ID" AutoGenerateColumns="true">
                        </telerik:GridTableView>
                    </DetailTables>
                    <Columns>
                        <telerik:GridBoundColumn DataField="TITLE" HeaderText="Title"></telerik:GridBoundColumn>
                        
                        <telerik:GridBoundColumn DataField="DATA" HeaderText="Data"></telerik:GridBoundColumn>
                        
                        <telerik:GridBoundColumn DataField="DATE" HeaderText="Date"></telerik:GridBoundColumn>
                        
                    </Columns>
                    <NestedViewTemplate>
                        <div class="row">
                            <div class="span11">
                                <h3>
                                    <asp:Literal ID="Literal1" runat="server" Text='<%#eval("TITLE") %>'></asp:Literal>                                            </h3>
                                <h5>
                                    <asp:Literal ID="Literal2" runat="server" Text='<%#eval("OWNER") %>'></asp:Literal>                                            </h5>
                            </div>
                            <div class="span11">
                                <p>
                                    <asp:Literal ID="Literal3" runat="server" Text='<%#eval("ALLDETAILS") %>'></asp:Literal></p>
                            </div>
                            <div class="span11">
                            </div>
                        </div>
                    </NestedViewTemplate>
                </MasterTableView>
            </telerik:RadGrid>

As the DetailsTable has N number of elements, i have it using a generated datatable on bind to fill with data, and the nestedview can be split to a seperate datasource if need be, but currently is using the radgrid datasource (sqldatasource).

Is there a way to accomplish a nestedview AND a detailsTable on the same hierarchical level in a Grid that i might have missed ?

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 23 Jun 2016, 06:42 AM
Hi Matthew,

Generally, RadGrid provides DetailItemTemplate, which you can use with built-in DetailTables hierarchy structure:
http://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/rows/detailitemtemplate/defaultcs.aspx

However, in your scenario using templates seems more appropriate. Therefore, you will need to remove the DetailTables and place the second grid within a NestedViewTemplate:
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/hierarchy-with-templates/defaultcs.aspx

For displaying the persons linked to the item in a Card-View fashion, you can use a RadListView:
http://demos.telerik.com/aspnet-ajax/listview/examples/appearancestyling/predefinedlayouts/defaultcs.aspx

I am also sending a sample RadGrid/RadListView web site to demonstrate a similar implementation.

I hope this will prove helpful.

Regards,
Eyup
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
CoGG
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or