Hi all,
I was manage to display the parent-child relation in datagrid. but the problem is all the child information display only in 1 template column and the rest of template columns are blank. how can i solve this problem. here is my code
sorry if my english is bad.
<asp:DataGrid id="dgrdList" Runat="server" CssClass="DataGrid" Width="1000" PagerStyle-Visible="false"
PageSize="10" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false" BorderWidth="0">
<Columns>
<asp:TemplateColumn HeaderText="ID" SortExpression="ASSET_ID">
<ItemStyle VerticalAlign=Top></ItemStyle>
<ItemTemplate>
<table><tr><td><img src="../Images/plus.gif" id=imgOpen<%# DataBinder.Eval(Container, "DataItem.ASSET_ID") %> onclick="javascript:makeVisible('submenu<%# DataBinder.Eval(Container, "DataItem.ASSET_ID") %>',showflag,this);"></td>
<td><asp:Label Id="lblInventoryID" Text='<%# DataBinder.Eval(Container, "DataItem.ASSET_ID") %>' Runat="server" /></td>
<td></td>
</tr></table>
<!-- Div Starts Here -->
<div style="visibility:hidden;display:none" id=submenu<%# DataBinder.Eval(Container, "DataItem.ASSET_ID") %> >
<!-- Second DataGrid Starts Here -->
<asp:datagrid id="Datagrid2" style="Z-INDEX: 101; " runat="server" BorderStyle=None
DataSource='<%# DataBinder.Eval(Container, "DataItem.myRelation") %>'
SelectedIndex="0" PageSize="1" AutoGenerateColumns="False" ShowFooter="false" Width="300px">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<table>
<tr>
<td width="20px"></td>
<td><img src="../Images/tree.jpg"></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="VENDOR_NAME" HeaderText="Vendor"></asp:BoundColumn>
<asp:BoundColumn DataField="PO_NUM" HeaderText="Po No"></asp:BoundColumn>
<asp:BoundColumn DataField="INVOICE_NUM" HeaderText="Invoice No"></asp:BoundColumn>
<asp:BoundColumn DataField="LICENSE_NUM" HeaderText="License No"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
<!-- Second DataGrid Ends Here -->
</div>
<!-- Div Ends Here -->
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Software Name" HeaderStyle-Width="20%" SortExpression="ASSET_DESC">
<ItemStyle VerticalAlign=Top></ItemStyle>
<ItemTemplate>
<asp:Label Id="lblSoftwarename" Style="width:120px;" Text='<%# DataBinder.Eval(Container, "DataItem.ASSET_DESC") %>' Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>