protected void btnSaveReason_Click(object sender, EventArgs e) { SelectedTab = 0; using (var dataAccess = new AdminDataAccess(null)) { if (hfSelectedReason.Value != string.Empty) { var reasonId = int.Parse(hfSelectedReason.Value); dataAccess.UpdateReason(reasonId, tbReason.Text, cbActive.Checked); } else { var result = dataAccess.AddNewReason(tbReason.Text, cbActive.Checked); if (result != string.Empty) { lblErrorMessage.Text = result; mpeNonRevOverview.Show(); } } } hfSelectedReason.Value = string.Empty; PopulateReasonGrid(); }