public void grdProjects_Itemcommand(Object sender, DataGridCommandEventArgs e)
    {
        Int32 _twc_proj_number_ID = 0;
        DataSet dsExpand = new DataSet();
        project_invoice _pi = new project_invoice();
        switch (e.CommandName)
        {

            case "Expand":
                {

                    _twc_proj_number_ID = Convert.ToInt32(grdProjects.DataKeys[Convert.ToInt32(e.Item.ItemIndex)]);
                    _twc_proj_number_ID = Convert.ToInt32(grdProjects.DataKeys[e.Item.ItemIndex]);
                    dsExpand = _pi.GetInvoiceforProject(Convert.ToInt32(_twc_proj_number_ID.ToString()));
                    PlaceHolder exp = new PlaceHolder();
                    exp = (System.Web.UI.WebControls.PlaceHolder)e.Item.Cells[10].FindControl("ExpandedContent");
                    ImageButton img = new ImageButton();
                    img = (System.Web.UI.WebControls.ImageButton)e.Item.Cells[0].FindControl("btnExpand");
                    if (dsExpand.Tables[0].Rows.Count > 0)
                    {
                        if (img.ImageUrl == "assets/img/Plus.gif")
                        {
                            img.ImageUrl = "assets/img/Minus.gif";
                            exp.Visible = true;
                            ((Whitfield_financialmgmt_child)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            ((Whitfield_financialmgmt_child)(e.Item.FindControl("DynamicTable1"))).ProjectNumber = _twc_proj_number_ID;
                            ((Whitfield_financialmgmt_child)(e.Item.FindControl("DynamicTable1"))).FetchSubMaterials(dsExpand);

                        }
                        else
                        {
                            exp.Visible = false;
                            ((Whitfield_financialmgmt_child)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                            img.ImageUrl = "assets/img/Plus.gif";
                        }
                    }
                    else
                    {
                        if (img.ImageUrl == "assets/img/Plus.gif")
                        {
                            //((ViewDesignAdmin)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            img.ImageUrl = "assets/img/Minus.gif";
                            exp.Visible = true;
                            ((Whitfield_financialmgmt_child)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            ((Whitfield_financialmgmt_child)(e.Item.FindControl("DynamicTable1"))).ProjectNumber = _twc_proj_number_ID;
                            ((Whitfield_financialmgmt_child)(e.Item.FindControl("DynamicTable1"))).FetchSubMaterials(dsExpand);
                        }
                        else
                        {
                            exp.Visible = false;
                            ((Whitfield_financialmgmt_child)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                            img.ImageUrl = "assets/img/Plus.gif";
                        }

                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
    private void DisplayGrid(Int32 material_id)
    {
        try
        {

            project_invoice _pi = new project_invoice();
            DataSet _dsInvoices = new DataSet();
            _dsInvoices = _pi.GetInvoiceforProject(Convert.ToInt32(ViewState["twc_project_number"].ToString()));
            PopulateDataGrid(_dsInvoices, grdinv);
        }
        catch (Exception exp)
        {
            Response.Write(exp.Message.ToString());
        }
    }