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.DeleteSubContingency(Convert.ToInt32(DetailId)); DataSet dsGridResults = _wc.FetchSubContingencyData(Convert.ToInt32(ViewState["cont_id"].ToString())); PopulateDataGrid(dsGridResults, grd1); }