Hello,
I have a hierachial RadGrid and would like to be able to set the DataSource for the nested tables at runtime on the server based on criteria in the parent grid. Currently, it looks a little bit like this:
<telerik:RadGrid ID="grid1" Skin="Default" runat="server" Visible="False" AutoGenerateColumns="False" |
ShowHeader="False" Width="400px" OnItemDataBound="grid1_ItemDataBound" AllowMultiRowSelection="True" |
OnRowDrop="grid1_RowDrop" OnDeleteCommand="grid1_DeleteCommand" OnPreRender="grid1_PreRender"> |
<MasterTableView DataKeyNames="AnswerID"> |
<DetailTables> |
<telerik:GridTableView Name="grid2"> |
<Columns> |
<telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="AnswerLabel" |
ReadOnly="True" Reorderable="False" Resizable="False" ShowSortIcon="False" UniqueName="colAnswerLabel"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="QuestionID" UniqueName="colQuestionID" Visible="False"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="AnswerID" UniqueName="colAnswerID" Visible="False"> |
</telerik:GridBoundColumn> |
</Columns> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
</telerik:GridTableView> |
</DetailTables> |
<Columns> |
<telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="AnswerLabel" |
ReadOnly="True" Reorderable="False" Resizable="False" ShowSortIcon="False" UniqueName="colAnswerLabel"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="QuestionID" UniqueName="colQuestionID" Visible="False"> |
</telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="AnswerID" UniqueName="colAnswerID" Visible="False"> |
</telerik:GridBoundColumn> |
</Columns> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
</MasterTableView> |
<ClientSettings AllowRowsDragDrop="True"> |
<Selecting AllowRowSelect="True" /> |
</ClientSettings> |
</telerik:RadGrid> |
During the course of the app, I can easily bind to grid1, but how can I bind DataTables to grid2 that are not in a relational database relationship to grid1? Is there a way to bind one or two of the nested grids at runtime based on information contained in the corresponding row in grid1 and provided by the user?