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); }