nesting gridviews programmatically

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

Hello. I have a main gridview that has a nested gridview in it (using
template field). But I need to add another nested gridview to the already
nested gridview. The main gridview is the parent while the first nested
gridview is the child of the main. The second gridview is a child of the
first gridview. Something like a heirarchy. Like the following;
main gridview
nested gridview
nested gridview

But, I have noticed that between the rows of the main gridview there is a
space that gets wider with each nested gridview. Can't have this. So, I am
wondering if it is possible to add each nested gridview only when it is
needed, programmatically? If so, how? On the main and first nested would be
an arrow at the beginning of each row that when clicked shows the children of
that row. When that arrow is clicked, the next nested gridview would be
added. Or, I would prefer this, is it possible to get rid of the space
between the rows that the template nested gridview is causing? Below is the
source code for the first nested gridview.

<%--The first nested gridview information--%>
<asp:TemplateField>
<ItemTemplate>
</td></tr
<tr>
<td colspan="100%" >
<div id="div<%# Eval("ChangeRequestID")
%>" style="display:none;position:relative;left:50px;" >
<asp:GridView
ID="gvwChangeRequestChildren"
runat="server"
Width="70%"

AutoGenerateColumns="false"
EmptyDataText="No
child change requests for the above selected parent change request."

DataKeyNames="IsChildOf"
Font-size="10px">
<Columns>
<asp:BoundField
DataField="ChangeRequestID" HeaderText="Child ID" />
<asp:BoundField
DataField="ChangeRequest" HeaderText="Change Request" />
<asp:BoundField
DataField="DevTargetEndDate" HeaderText="Target End Date"
DataFormatString="{0:M-d-yyyy}" />
</Columns>
</asp:GridView>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>

Thanks for reviewing and your thoughts on this.

.... John
 
Back
Top