Normally i put a DataSet into a GridView (inside the code behind c# class), and bind it to the corresponding aps.net page.

Something like this:

Sample.aspx

...

<div id="DivDataGrid" class="divDataGridScroll" >
<asp:GridView ID="GridView2" runat="server" Visible="true" AllowPaging="True"
OnPageIndexChanging="GridView2_PageIndexChanging" CssClass="textnormal"
BackColor="White" BorderColor="White" GridLines="Vertical" BorderStyle="Dotted"
Width="100%" onrowcreated="GridView2_RowCreated"
onrowdatabound="GridView2_RowDataBound" >
<RowStyle VerticalAlign="Top" />
<PagerStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" CssClass="tablehead3" />
<AlternatingRowStyle CssClass="cssGrey0" />
<FooterStyle CssClass="textnormal" BackColor="White" />
</asp:GridView>
</div>
...

Sample.aspx.cs

...
private void Page_PreRender(object sender, EventArgs e)
{

if (m_ds != null)
{

GridView2.DataSource = m_ds.Tables["MediName"];
GridView2.DataBind();
}
}
...
Which works fine. But now I want to use the gridview inside a TreeView.

E.g. something like this:

-Category1
-Category1.1
--GridView1.1
-Category1.2
-Category2
-Category2.1
-Category2.2
-Category2.3
-Category2.3.1
--GridView2.3.1
...

I've implemented the TreeView as the following:

TreeNode.aspx:
...
<asp:TreeView Runat="Server" ExpandImageUrl="Image/pill_os.gif" CollapseImageUrl="Image/pill_slide.gif" OnTreeNodePopulate="Node_Populate" ID="Menu_Tree" >
<Nodes>
<asp:TreeNode Text="KAPITELNAME" PopulateOnDemand="True" Value="0"/>
</Nodes>
<NodeStyle CssClass="menu" width="100%" />
</asp:TreeView>
...

TreeNode.aspx.cs
...
protected void Node_Populate(object sender, System.Web.UI.WebControls.TreeNodeEventArgs e)
{
...handle NodeDepth
if(Node at bottom)
{
new Node = new TreeNode("<table>...a hard coded html-table that handles the DataSet...</table>
--> Here I want to take the DataSet and bind it somehow to the TreeNode instead of static html code!!

}

Can anyone give me some ideas? Is there any "easy" way to bind a Gridview to a TreeNode, that can be displayed dynamically?

(I also tought about another approach of making a HelperClass like the sample.aspx, that creates dynamic html code for the dataGrid (and then I put that code into the TreeNode), but I failed in making an instance of that class and passing the dataset to it...)