I am building a hierarchical datagrid that has a relation between 2 tables in a dataset. When I run the app, I get the following error on the aspx page.
Compiler Error Message: CS0117: 'object' does not contain a definition for 'CreateChildView'
Below is the code for the page. Should I be using "Container.DataItem.CreateChildView("relation")" for my datasource in the nested datagrid?
Code:<asp:DataGrid id=dg runat="server" DataSource="<%# dsProfiles %>" DataMember="tbl_identity" DataKeyField="identity_id" AutoGenerateColumns="False" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3" GridLines="Horizontal" CellSpacing="1" Font-Names="Arial" Font-Size="9pt"> <SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle> <AlternatingItemStyle BackColor="AliceBlue"></AlternatingItemStyle> <ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle> <HeaderStyle Font-Size="9pt" Font-Names="Arial" Font-Bold="True" ForeColor="White" BackColor="MidnightBlue"></HeaderStyle> <FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle> <Columns> <asp:TemplateColumn> <ItemStyle Width="9px"></ItemStyle> <ItemTemplate> <asp:ImageButton ImageUrl="../images/icon-plus.gif" CommandName="Expand" ID="btnExpand" Runat="server"></asp:ImageButton> </ItemTemplate> </asp:TemplateColumn> <asp:BoundColumn DataField="fname" SortExpression="fname" HeaderText="First"></asp:BoundColumn> <asp:BoundColumn DataField="lname" SortExpression="lname" HeaderText="Last"></asp:BoundColumn> <asp:BoundColumn DataField="email" SortExpression="email" HeaderText="Email"></asp:BoundColumn> <asp:BoundColumn DataField="dateadded" SortExpression="dateadded" HeaderText="Date Created"></asp:BoundColumn> <asp:BoundColumn DataField="timeadded" SortExpression="timeadded" HeaderText="Time"></asp:BoundColumn> <asp:TemplateColumn> <ItemStyle Width="1px"></ItemStyle> <ItemTemplate> <asp:PlaceHolder ID="ExpandedContent" Visible="False" Runat="server"> </td> </tr> <tr> <td width="9"> </td> <td colspan="5"> <asp:DataGrid id="dgSub" runat="server" DataSource='<%# Container.DataItem.CreateChildView("tbl_identitytbl_authenticate") %>' DataMember="tbl_identity" DataKeyField="identity_id" Width="95%" AutoGenerateColumns="False" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3" GridLines="Horizontal" CellSpacing="1" Font-Names="Arial" Font-Size="9pt"> <SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle> <AlternatingItemStyle BackColor="AliceBlue"></AlternatingItemStyle> <ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle> <HeaderStyle Font-Size="9pt" Font-Names="Arial" Font-Bold="True" ForeColor="White" BackColor="MidnightBlue"></HeaderStyle> <FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle> <Columns> <asp:BoundColumn DataField="uname" HeaderText="Username" /> <asp:BoundColumn DataField="pword" HeaderText="Password" /> </Columns> </asp:DataGrid> </asp:PlaceHolder> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid>


Reply With Quote