I am trying to set the datasource inside the RadGrid which is embedded inside the itemtemplate of RadTreeNode
I am trying to set the data source in the code as below
Seems it is invalid. and i get the following error. Unable to cast object of type 'System.Web.UI.CompiledTemplateBuilder' to type 'Telerik.Web.UI.RadGrid'.
I am not sure what am i doing wrong and also pretty new to asp.net with rad controls
<telerik:RadTreeView ID="RadTreeView1" runat="server"> <Nodes> <telerik:RadTreeNode runat="server" Text="Root RadTreeNode1"> <Nodes> <telerik:RadTreeNode runat="server" Text="Child RadTreeNode 1"> <NodeTemplate> <telerik:RadGrid ID="AllocGrid" Width="98%" AllowSorting="False" AllowPaging="False" GridLines="None" AutoGenerateColumns="False" runat="server" Skin="Windows7" Height="147px" Style="margin-top: 102px"> <MasterTableView Width="100%" Summary="RadGrid table" EditMode="InPlace"> <Columns> <telerik:GridBoundColumn DataField="Type" HeaderText="Allocation Type" ItemStyle-Width="100px" HeaderStyle-Width="100px" /> <telerik:GridTemplateColumn DataField="Status" HeaderText="Status" ItemStyle-Width="300px" HeaderStyle-Width="300px"> <ItemTemplate> <%# GetStatus((String)Eval("Stats"))%> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Link" HeaderText="View"> <ItemTemplate> <%# GetTheoreticalAllocationsLink() %> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid> </NodeTemplate> </telerik:RadTreeNode> </Nodes> </telerik:RadTreeNode> </Nodes> </telerik:RadTreeView>I am trying to set the data source in the code as below
((Telerik.Web.UI.RadGrid) RadTreeView1.Nodes[0].Nodes[0].NodeTemplate).DataSource = dataSource;Seems it is invalid. and i get the following error. Unable to cast object of type 'System.Web.UI.CompiledTemplateBuilder' to type 'Telerik.Web.UI.RadGrid'.
I am not sure what am i doing wrong and also pretty new to asp.net with rad controls