public void PageResultGrid1(object sender, DataGridPageChangedEventArgs e)
 {
     DataSet dsGridResults;
     grdRpResults.CurrentPageIndex = e.NewPageIndex;
     Whitfieldcore wUser = new Whitfieldcore();
     dsGridResults = wUser.GetAllSubMaterials(ddlMatType.SelectedItem.Value, "Grid");
     this.PopulateDataGrid(dsGridResults);
 }
    private void DisplayGrid(Int32 material_id)
    {
        try
        {
            Whitfieldcore _DbClass = new Whitfieldcore();
            DataSet dsSubMats = _DbClass.GetAllSubMaterials(material_id);
            PopulateDataGrid(dsSubMats, grdpl1);

        }
        catch (Exception exp)
        {
            Response.Write(exp.Message.ToString());
        }
    }
    public void grdpl1_Itemcommand(Object sender, DataGridCommandEventArgs e)
    {
        Int32 Material_ID = 0;
        DataSet dsExpand = new DataSet();
        Whitfieldcore _dbClass = new Whitfieldcore();
        switch (e.CommandName)
        {

            case "Expand":
                {

                    Material_ID = Convert.ToInt32(grdpl1.DataKeys[Convert.ToInt32(e.Item.ItemIndex)]);
                    Material_ID = Convert.ToInt32(grdpl1.DataKeys[e.Item.ItemIndex]);
                    dsExpand = _dbClass.GetAllSubMaterials(Material_ID);
                    PlaceHolder exp = new PlaceHolder();
                    exp = (System.Web.UI.WebControls.PlaceHolder)e.Item.Cells[6].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;
                            ((submaterial)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            ((submaterial)(e.Item.FindControl("DynamicTable1"))).Material_ID = Material_ID;
                            ((submaterial)(e.Item.FindControl("DynamicTable1"))).FetchSubMaterials(dsExpand);

                        }
                        else
                        {
                            exp.Visible = false;
                            ((submaterial)(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;
                            ((submaterial)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                            ((submaterial)(e.Item.FindControl("DynamicTable1"))).Material_ID = Material_ID;
                            ((submaterial)(e.Item.FindControl("DynamicTable1"))).FetchSubMaterials(dsExpand);
                        }
                        else
                        {
                            exp.Visible = false;
                            ((submaterial)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                            img.ImageUrl = "assets/img/Plus.gif";
                        }

                    }
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
 private void BindSubMaterials()
 {
     DataSet dsGrp = new DataSet();
     Whitfieldcore wUser = new Whitfieldcore();
     dsGrp = wUser.GetAllSubMaterials(ddlMatType.SelectedItem.Value,"Grid");
     this.PopulateDataGrid(dsGrp);
        // if (dsGrp.Tables[0].Rows.Count > 0)
       //  {
         //RdoPrjClient.DataSource = dsGrp;
         //RdoPrjClient.DataTextField = "matdesc";
         //RdoPrjClient.DataValueField = "sub_mat_id";
         //RdoPrjClient.DataBind();
        // }
 }
 private void BindSubMaterials()
 {
     DataSet dsGrp = new DataSet();
     Whitfieldcore wUser = new Whitfieldcore();
     dsGrp = wUser.GetAllSubMaterials(ddlMatType.SelectedItem.Value);
     if (dsGrp.Tables[0].Rows.Count > 0)
     {
         RdoPrjClient.DataSource = dsGrp;
         RdoPrjClient.DataTextField = "matdesc";
         RdoPrjClient.DataValueField = "sub_mat_id";
         RdoPrjClient.DataBind();
     }
 }