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

Something like this:



<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" />


private void Page_PreRender(object sender, EventArgs e)

if (m_ds != null)

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

E.g. something like this:


I've implemented the TreeView as the following:

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

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...)