public void grdEmpl_Itemcommand(Object sender, DataGridCommandEventArgs e)
    {
        String loginid = "";
        DataSet dsExpand = new DataSet();
        WhitfieldPayroll _dbClass = new WhitfieldPayroll();
        switch (e.CommandName)
        {

            case "Expand":
                {

                    loginid = Convert.ToString(grdEmpl.DataKeys[e.Item.ItemIndex]);
                    dsExpand = _dbClass.GetPayRollProjectHoursForEmployee(loginid, txtFromDate.Text.Trim(), txtToDate.Text.Trim());
                    PlaceHolder exp = new PlaceHolder();
                    exp = (System.Web.UI.WebControls.PlaceHolder)e.Item.Cells[7].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_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).DisplayGrid(loginid, txtFromDate.Text.Trim(), txtToDate.Text.Trim());

                        }
                        else
                        {
                            exp.Visible = false;
                            ((Whitfield_Payroll_ByProject)(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_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).DisplayGrid(loginid, txtFromDate.Text.Trim(), txtToDate.Text.Trim());
                        }
                        else
                        {
                            exp.Visible = false;
                            ((Whitfield_Payroll_ByProject)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                            img.ImageUrl = "assets/img/Plus.gif";
                        }

                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
    public void DisplayGrid(String _userid,String FromDate, String ToDate)
    {
        try
        {
            WhitfieldPayroll _dbClass = new WhitfieldPayroll();
            DataSet dsSubMats = _dbClass.GetPayRollProjectHoursForEmployee(_userid, FromDate, ToDate);
            PopulateDataGrid(dsSubMats, grdEmpl);

        }
        catch (Exception exp)
        {
            Response.Write(exp.Message.ToString());
        }
    }
    private void DisplayGrid()
    {
        try
        {
            WhitfieldPayroll _dbClass = new WhitfieldPayroll();
            DataSet _dsRecords = new DataSet();
            if (ddlEmpl.SelectedItem.Value == "1")
            {
                grdProj.Visible = false;
                grdEmpl.Visible = true;
                txtSelectionResultsEmpl.Text = "Employee Payroll Hours";
                txtSelectionResultsProj.Text = "";
                _dsRecords = _dbClass.GetPayRollHoursForEmployee(txtFromDate.Text.Trim(), txtToDate.Text.Trim());
                PopulateDataGrid(_dsRecords, grdEmpl);
            }
            else
            {
                grdEmpl.Visible = false;
                grdProj.Visible = true;
                txtSelectionResultsProj.Text = "Project Payroll Hours";
                txtSelectionResultsEmpl.Text = "";
                _dsRecords = _dbClass.GetPayRollHoursForProjects(txtFromDate.Text.Trim(), txtToDate.Text.Trim());
                PopulateDataGrid(_dsRecords,grdProj);
            }

        }
        catch (Exception exp)
        {
            Response.Write(exp.Message.ToString());
        }
    }