public void grd1_EditCommand(object sender, DataGridCommandEventArgs e)
 {
     contingency _wc = new contingency();
     grd1.ShowFooter = false;
     grd1.EditItemIndex = Convert.ToInt32(e.Item.ItemIndex);
     DataSet dsGridResults = _wc.FetchSubTermsData(Convert.ToInt32(ViewState["cont_id"].ToString()));
     PopulateDataGrid(dsGridResults, grd1);
 }
 public void grd1_UpdateCommand(object sender, DataGridCommandEventArgs e)
 {
     String DetailId = grd1.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString();
     contingency _wc = new contingency();
     _wc.UpdateSubTerms(Convert.ToInt32(DetailId), ((TextBox)(e.Item.FindControl("txtdesc"))).Text, ((RadioButtonList)(e.Item.FindControl("chkis_default"))).SelectedItem.Value);
     grd1.EditItemIndex = -1;
     grd1.ShowFooter = true;
     DataSet dsGridResults = _wc.FetchSubTermsData(Convert.ToInt32(ViewState["cont_id"].ToString()));
     PopulateDataGrid(dsGridResults, grd1);
 }
 public void grd1_DeleteCommand(object sender, DataGridCommandEventArgs e)
 {
     contingency _wc = new contingency();
     String DetailId = "";
     DetailId = grd1.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString();
     Whitfieldcore _dbClass = new Whitfieldcore();
     _wc.DeleteSubTerms(Convert.ToInt32(DetailId));
     DataSet dsGridResults = _wc.FetchSubTermsData(Convert.ToInt32(ViewState["cont_id"].ToString()));
     PopulateDataGrid(dsGridResults, grd1);
 }
    public void grdEstimateMaterials_Itemcommand(Object sender, DataGridCommandEventArgs e)
    {
        Int32 term_id = 0;
        contingency mm = new contingency();
        switch (e.CommandName)
        {

            case "Expand":
                {

                    term_id = Convert.ToInt32(grdEstimateMaterials.DataKeys[Convert.ToInt32(e.Item.ItemIndex)]);
                    term_id = Convert.ToInt32(grdEstimateMaterials.DataKeys[e.Item.ItemIndex]);
                    DataSet dsExpand = mm.FetchSubTermsData(term_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.HasRows())
                    // {
                    if (img.ImageUrl == "assets/img/Plus.gif")
                    {
                        img.ImageUrl = "assets/img/Minus.gif";
                        exp.Visible = true;
                        ((master_terms1)(e.Item.FindControl("DynamicTable1"))).Visible = true;
                        ((master_terms1)(e.Item.FindControl("DynamicTable1"))).term_id = term_id;
                        ((master_terms1)(e.Item.FindControl("DynamicTable1"))).LoadDetails(dsExpand);

                    }
                    else
                    {
                        exp.Visible = false;
                        ((master_terms1)(e.Item.FindControl("DynamicTable1"))).Visible = false;
                        img.ImageUrl = "assets/img/Plus.gif";
                    }
                    //}
                    break;
                }
            default:
                {
                    break;
                }
        }
    }
 public void PageResultGrid1(object sender, DataGridPageChangedEventArgs e)
 {
     contingency mm = new contingency();
     DataSet dsGridResults;
     grd1.CurrentPageIndex = e.NewPageIndex;
     dsGridResults = mm.FetchSubTermsData(Convert.ToInt32(ViewState["cont_id"].ToString()));
     PopulateDataGrid(dsGridResults, grd1);
 }
 protected void btnSave_Click1(object sender, EventArgs e)
 {
     try
     {
         contingency mm = new contingency();
         Int32 IsValidInsert = mm.PopulateSubTerms(Convert.ToInt32(ViewState["cont_id"].ToString()), txtdesc.Text.Trim(), ddldefault.SelectedItem.Value);
         DataSet dsGridResults = mm.FetchSubTermsData(Convert.ToInt32(ViewState["cont_id"].ToString()));
         PopulateDataGrid(dsGridResults, grd1);
     }
     catch (Exception)
     {
         throw;
     }
 }