Nested Gridview
Hi ,
I am working on MOSS 2007. there are two different lists in my site. 1st list contain some information about vendor and second list contain all the detail information about vendor.
I have created one user control in asp.net. there are two gridview in user control. main list bind to 1st gridview. in first gridview ID filed is linkbutton field.
My requirement is, when user click on ID linkbutton then detail list should bind to second gridview. that second gridview should display exactly below of that row.
I have successfuly bind both the gridview but i dont know hot to display both gridview in treeview manner.
this is my first gridview. when user click on linkbutton then
OnRowCommand evet is fire n second second list bind to second gridview.
<
asp:GridView
ID="GridView1"
runat="server"
AutoGenerateColumns="False"
CellPadding
="4"
Width="100%"
BackColor="White"
BorderColor="#336666"
BorderStyle
="Double"
BorderWidth="3px"
GridLines="Horizontal"
EnableModelValidation="True"
OnRowCommand="GridView1_RowCommand">
<Columns
>
<asp:TemplateField
HeaderText
="Report No">
<ItemTemplate
>
<asp:LinkButton
ID="lblReportNo"
runat="server"
Text='<%#
Eval("ID") %>'
PostBackUrl="~/Default.aspx"
CommandName
="View">
</asp:LinkButton
>
<asp:HiddenField
ID="HiddenField1"
runat="server"
/>
</ItemTemplate
>
<HeaderStyle
ForeColor="Black"
/>
</asp:TemplateField>
</Column>
This
is my second gridview.
<
asp:GridView
ID="gvMain"
runat="server"
AutoGenerateColumns="False"
BackColor="LemonChiffon"
BorderColor="#336666"
BorderStyle="Double"
BorderWidth="2px"
CellPadding="2"
Font-Bold="True"
GridLines="Horizontal"
Height="55px"
Width
="644px">
<Columns
>
<asp:TemplateField
HeaderText
="Description">
<ItemTemplate
>
<asp:Label
ID="lbldscption"
runat="server"
Text='<%#
Eval("Description") %>'></asp:Label
>
</ItemTemplate
>
<HeaderStyle
ForeColor="White"
/>
</asp:TemplateField
>
Can anybody tell me how to use nested gridview.?
May 25th, 2011 6:34am