protected void btnAdd_Click(Object Sender, EventArgs e) { try { if (Request.Form[hdnId.UniqueID] == "0") { oProjectRequest.AddClass(txtName.Text, (chkEnabled.Checked ? 1 : 0)); } else { oProjectRequest.UpdateClass(Int32.Parse(Request.Form[hdnId.UniqueID]), txtName.Text, (chkEnabled.Checked ? 1 : 0)); } } catch (Exception ex) { Response.Write(ex.Message); Response.End(); } Response.Redirect(Request.Path); }