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

Switch from DetailTables to NestedView

1 Answer 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 07 Feb 2011, 05:15 PM
Hi, I currently have my RadGrid setup with DetailTables, but I would like to switch to NestedView to have more control over the presentation of the data.  For my Detailtables I useOnDetailTableDataBind, but the NestedView doesn't have that property.  What is the best route take if I have a datasource that can only be generated programmatic?

<telerik:RadGrid ID="RadGrid1" runat="server"
    AllowSorting="True" GridLines="None" ShowGroupPanel="True"
    OnNeedDataSource="RadGrid1_NeedDataSource"
    OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
    AllowFilteringByColumn="True">
    <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="True" ReorderColumnsOnClient="True">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView  DataKeyNames="ID" AllowMultiColumnSorting="True">
        <DetailTables>
            <telerik:GridTableView DataKeyNames="ID"  Width="100%"
                runat="server" AutoGenerateColumns ="false">
                <Columns>
                    <telerik:GridBoundColumn SortExpression="Joined" HeaderText="Joined" HeaderButtonType="TextButton"
                        DataField="Joined" UniqueName="Joined">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Status" HeaderText="Status" HeaderButtonType="TextButton"
                        DataField="Status" UniqueName="Status">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="City" HeaderText="City" HeaderButtonType="TextButton"
                        DataField="City" UniqueName="City">
                    </telerik:GridBoundColumn>
                </Columns>
            </telerik:GridTableView>
        </DetailTables>
        <NestedViewSettings>
         
        </NestedViewSettings>
    </MasterTableView>
</telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 08 Feb 2011, 05:55 AM
Hello Michael,

You can attach NeedDataSource event to inner grid and bind it through the NeedDataSource event. In the inner grid NeedDataSource event, you can get reference to the outer grid expanded item, e.g. the parent item. Thus you can get a data field value of the expanded item and use it for retrieving the inner grid data source.

For more information on this, please refer the following forum.
radGrid inside nestedviewTemplate problem

Thanks,
Princy.
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or