public void grdEstimateMaterials_DeleteCommand(object sender, DataGridCommandEventArgs e) { contingency _wc = new contingency(); String DetailId = ""; DetailId = grdEstimateMaterials.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString(); Whitfieldcore _dbClass = new Whitfieldcore(); _wc.DeleteTerms(Convert.ToInt32(DetailId)); _wc.DeleteSubTermsForTems(Convert.ToInt32(DetailId)); DataSet dsGridResults = _wc.FetchTermsData(); PopulateDataGrid(dsGridResults, grdEstimateMaterials); }