public void grd1_UpdateCommand(object sender, DataGridCommandEventArgs e) { String DetailId = grd1.DataKeys[Convert.ToInt32(e.Item.ItemIndex)].ToString(); contingency _wc = new contingency(); _wc.UpdatesubContingency(Convert.ToInt32(DetailId), ((TextBox)(e.Item.FindControl("txtdesc"))).Text, ((RadioButtonList)(e.Item.FindControl("chkUOM"))).SelectedItem.Value, ((TextBox)(e.Item.FindControl("txtcost"))).Text, ((RadioButtonList)(e.Item.FindControl("chkis_default"))).SelectedItem.Value); grd1.EditItemIndex = -1; grd1.ShowFooter = true; DataSet dsGridResults = _wc.FetchSubContingencyData(Convert.ToInt32(ViewState["cont_id"].ToString())); PopulateDataGrid(dsGridResults, grd1); }