Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys,
i have a question:
i have to make a multilevel nested gridview, that means i dont know how often i have to create a new childgridview in my parent gridview(headers are always the same).
My probem is how can i make this dynamically?
I tryed(Multilevel Nested Master/Detail Data Display Using GridView[^] ) a lot.

ASP.NET
<asp:GridView ID="GridView1" runat="server"  AutoGenerateColumns="False"
        OnRowDataBound="GridOnRowDataBound" ForeColor="#333333" Height="214px"
        Width="555px">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <a href="javascript:switchViews('div<%# Eval("ID") %>', 'one');">
                        <img id="imgdiv<%# Eval("ID") %>" alt="Click to show/hide orders" border="0" src="plus.png" />
                    </a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField ="ID" HeaderText="ID:"/>
            <asp:BoundField DataField="Firstname" HeaderText="Firstname:"/>
            <asp:BoundField DataField="LastName" HeaderText="Lastname:"/>
            <asp:BoundField DataField="Parent" HeaderText="Parent:"/>
            <asp:TemplateField>
                <ItemTemplate>
                ...


protected void GridOnRowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {             
                GridView gv = (GridView)(e.Row.FindControl("GridView2"));     
                gv.DataSource =buffer2; //objectlist
                gv.DataBind();
            }
        }


may someone can give me a good advice how to solve it.
thanks alot
Posted
Updated 27-May-13 2:42am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900