ukinet
asked on
Load Xml Data in Nested Gridview
Hi,
I have a nested Gridview (a Gridview within a Gridview), which is from a customers table. The main Gridview lists the customer's name and the nested Gridview is to list the related products for the customer, which is stored as xml within the database table. The code takes the following form (formatting, etc. removed):
<asp:GridView id="Customers" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table>
<tr>
<td>
<asp:Label id="Customer" runat="server"><%# DataBinder.Eval(((GridView Row)Contai ner).DataI tem, "Customer") %></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:XmlDataSource id="xxmlData" runat="server" EnableCaching="false"></as p:XmlDataS ource>
<asp:GridView id="Products" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table>
<tr>
<td>
<asp:Label id="Product" runat="server"><%# XPath("Product") %></asp:Label>
</td>
<td>
<asp:ImageButton id="ProductLink" runat="server" CommandName='<%# XPath("ProductID") %>' OnClick="View" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Does anyone know how I can load the Xml data into the nested Gridview via the XmlDataSource?
Thanks,
John
I have a nested Gridview (a Gridview within a Gridview), which is from a customers table. The main Gridview lists the customer's name and the nested Gridview is to list the related products for the customer, which is stored as xml within the database table. The code takes the following form (formatting, etc. removed):
<asp:GridView id="Customers" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table>
<tr>
<td>
<asp:Label id="Customer" runat="server"><%# DataBinder.Eval(((GridView
</td>
</tr>
<tr>
<td>
<asp:XmlDataSource id="xxmlData" runat="server" EnableCaching="false"></as
<asp:GridView id="Products" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table>
<tr>
<td>
<asp:Label id="Product" runat="server"><%# XPath("Product") %></asp:Label>
</td>
<td>
<asp:ImageButton id="ProductLink" runat="server" CommandName='<%# XPath("ProductID") %>' OnClick="View" />
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Does anyone know how I can load the Xml data into the nested Gridview via the XmlDataSource?
Thanks,
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.