Ref: Nested GridView with TreeView like structure in ASP.Net using C# and VB.Net
Download add the following event on Orders Gridview:
<asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false" PageSize="5"
AllowPaging="true" OnPageIndexChanging="OnOrdersGrid_PageIndexChanging" OnRowDataBound="gvOrders_RowDataBound" CssClass="ChildGrid"
DataKeyNames="OrderId">
Here is the C# code of RowDataBound:
protected void gvOrders_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string orderId = e.Row.Cells[1].Text;
DataTable dt = GetData(string.Format("SELECT ProductId, ProductName FROM Products WHERE ProductId IN (SELECT ProductId FROM [Order Details] WHERE OrderId = '{0}')", orderId));
if (dt.Rows.Count < 0)
{
((ImageButton)e.Row.Cells[1].FindControl("imgProductsShow")).Visible = false;
}
else
{
((ImageButton)e.Row.Cells[1].FindControl("imgProductsShow")).Visible = true;
}
}
}
it might be possible that the image will not hide tri to debug the code and set the NextStatement As 