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

Does a nested view demand a seperate datasource?

1 Answer 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Crane101
Top achievements
Rank 1
Crane101 asked on 20 Aug 2010, 11:12 AM

I'm using a nested view, where all the data (columns) required already exist in the master grid's data source, so I do not need to use a separate datasource or query for the nested view.
However, when I expand my nested view for a row, it always displays data for the FIRST row no matter which row I expand.

Frustratingly my edit form, which basically performs the same function, returns the correct data for the selected row.

Have Telerik accounted for the possibility that all the data required can come from the grid's data source, or is this a limitation of the control?

Thanks,

Shane

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 24 Aug 2010, 11:52 AM
Hi Shane,

Indeed, RadGrid's NestedViewTemplate can use the same datasource as its parent item. A separate datasource is needed only if you want to use the NestedViewTemplate's "load-on-demand" feature. The following is a sample declaration of single datasource databinding:

<telerik:RadGrid runat="server" DataSourceID="SqlDataSource1">
    <MasterTableView AutoGenerateColumns="False" DataKeyNames="CategoryID" DataSourceID="SqlDataSource1">
        <Columns>
            <telerik:GridBoundColumn DataField="CategoryID" DataType="System.Int32" HeaderText="CategoryID"
                ReadOnly="True" SortExpression="CategoryID" UniqueName="CategoryID" />
            <telerik:GridBoundColumn DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName"
                UniqueName="CategoryName" />
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description"
                UniqueName="Description" />
        </Columns>
        <NestedViewTemplate>
            <%#Eval("CategoryID")%> <!--same value as from the parent's item-->
            <%#Eval("CategoryName")%><!--same value as from the parent's item-->
            <%#Eval("Description")%><!--same value as from the parent's item-->
        </NestedViewTemplate>
    </MasterTableView>
</telerik:RadGrid>

All the best,
Rosen
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Crane101
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or