Hi Dharmendr,
The code as below :
HTML
<div>
<asp:GridView ID="gvParentGrid" runat="server" Width="1550px" DataKeyNames="RegDate"
AutoGenerateColumns="false" OnRowDataBound="gvUserInfo_RowDataBound" GridLines="None"
BorderStyle="Solid" BorderColor="#999999" BorderWidth="2px" Visible="false" ShowHeader="False"
OnSelectedIndexChanged="gvChildGrid_SelectedIndexChanged">
<HeaderStyle CssClass="GridStyleParent" />
<RowStyle BackColor="White" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField ItemStyle-Width="20px">
<ItemTemplate>
<a href="JavaScript:divexpandcollapse('div<%# Eval("RegDate") %>');">
<img id="imgdiv<%# Eval("RegDate") %>" width="30px" border="0" src="plus.png" /></a>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RegDate" HeaderText="" HeaderStyle-HorizontalAlign="Left" />
<asp:TemplateField>
<ItemTemplate>
<tr>
<td colspan="100%">
<div id="div<%# Eval("RegDate") %>" style="display: none; position: relative; left: 15px;
overflow: auto">
<%--
<asp:Label ID="lblRegDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"RegDate")%>' Visible="false"></asp:Label>--%>
<asp:GridView ID="gvChildGrid" runat="server" PageSize="15" ForeColor="Black" BorderColor="#999999"
BorderStyle="Solid" BorderWidth="2px" AllowPaging="true" Style="text-align: Left;
position: relative;" AutoGenerateColumns="False" OnRowDataBound="gvChildGrid_RowDataBound"
OnSelectedIndexChanged="gvChildGrid_SelectedIndexChanged" DataKeyNames="RegDate"
OnPageIndexChanging="OnChildGrid_PageIndexChanging">
<RowStyle BackColor="White" />
<HeaderStyle CssClass="GridStyleHeader" ForeColor="White" />
<Columns>
<asp:TemplateField HeaderText="No.">
<ItemTemplate>
<%#Container.DataItemIndex + 1%>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField ReadOnly="true" HeaderText="Register Date" DataField="RegDate" SortExpression="RegDate" />
<asp:BoundField ReadOnly="true" HeaderText="Log.Month" DataField="LogMon" SortExpression="LogMon" />
<asp:BoundField ReadOnly="true" HeaderText="Company" DataField="Company" SortExpression="Company" />
<asp:BoundField ReadOnly="true" HeaderText="Cost Center" DataField="CostCenter" ItemStyle-CssClass="hiddencol"
HeaderStyle-CssClass="hiddencol">
<HeaderStyle CssClass="hiddencol"></HeaderStyle>
<ItemStyle CssClass="hiddencol"></ItemStyle>
</asp:BoundField>
<asp:BoundField ReadOnly="true" HeaderText="App.CTG" DataField="AppCTG" SortExpression="AppCTG" />
<asp:BoundField ReadOnly="true" HeaderText="Ref.NO." DataField="RefNo" SortExpression="RefNo" />
<asp:BoundField ReadOnly="true" HeaderText="Category" DataField="CatType" NullDisplayText=" "
ItemStyle-CssClass="hiddencol" HeaderStyle-CssClass="hiddencol">
<HeaderStyle CssClass="hiddencol"></HeaderStyle>
<ItemStyle CssClass="hiddencol"></ItemStyle>
</asp:BoundField>
<asp:BoundField ReadOnly="true" HeaderText="Group" DataField="Group" SortExpression="Group" />
<asp:BoundField ReadOnly="true" HeaderText="Owner" DataField="Owner" SortExpression="Owner" />
..................
</Columns>
</asp:GridView>
</div>
</td>
</tr>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</td> </div>
Code Behind :
Protected Sub gvUserInfo_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
Dim strConnString As String = ConfigurationManager.ConnectionStrings("ConString").ConnectionString
Dim adapter As New SqlDataAdapter()
Dim ds As New DataSet()
Dim con As New SqlConnection(strConnString)
Dim cmd As New SqlCommand()
Dim count As Integer = 0
If e.Row.RowType = DataControlRowType.DataRow Then
con.Open()
Dim gvChildGrid As GridView = TryCast(e.Row.FindControl("gvChildGrid"), GridView)
Dim RegDate As String = gvParentGrid.DataKeys(e.Row.RowIndex).Value.ToString()
cmd.CommandType = CommandType.StoredProcedure
lblMessage.Text = LinksTreeView.SelectedValue
If lblMessage.Text = "-" + "By Year" Then
cmd.CommandText = "SP_GetReqIssueByYear"
Else
cmd.CommandText = "SP_GetReqIssueByMonth"
End If
cmd.Parameters.AddWithValue("@RegDate", RegDate)
cmd.Connection = con
adapter = New SqlDataAdapter(cmd)
adapter.Fill(ds)
con.Close()
gvChildGrid.DataSource = ds.Tables(0)
gvChildGrid.DataBind()
End If
End Sub
Protected Sub OnChildGrid_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
If Page.IsPostBack Then
Dim gvChildGrid As GridView = DirectCast(sender, GridView)
gvChildGrid.PageIndex = e.NewPageIndex
gvChildGrid.DataBind()
End If
End Sub
Thanks in Advanced