protected void chkIsHasOther_OnCheckedChanged(object sender, EventArgs e) { foreach (GridDataItem item in rgFlagReason.Items) { CheckBox chkIsHasOther = (CheckBox)item.FindControl("chkIsHasOther"); HiddenField hdfIdOther = (HiddenField)item.FindControl("hdfIdOther"); if (hdfIdOther != null) { try { FlagReasons f = FlagReasons.GetFlagReasons(new Guid(hdfIdOther.Value)); if (f != null) { if (chkIsHasOther.Checked) { f.isHasOther = true; //f.Description = string.Empty; } else { f.isHasOther = false; } f.Save(); } } catch { } } } BindGrid(true); }
protected void chkAcDec_OnCheckedChanged(object sender, EventArgs e) { foreach (GridDataItem item in rgFlagReason.Items) { CheckBox chkAcDec = (CheckBox)item.FindControl("chkAcDec"); HiddenField hdfId = (HiddenField)item.FindControl("hdfId"); if (hdfId != null) { try { FlagReasons f = FlagReasons.GetFlagReasons(new Guid(hdfId.Value)); if (f != null) { if (chkAcDec != null) { if (chkAcDec.Checked) { f.IsActive = true; } else { f.IsActive = false; } f.Save(); } } } catch { } } } BindGrid(true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { f = FlagReasons.NewFlagReasons(); flagIdString = Request.QueryString["id"]; if ((flagIdString != null && Guid.TryParse(flagIdString, out flagId))) { f = FlagReasons.GetFlagReasons(flagId); } LoadForm(); PopulateForm(f); } }
protected void btnSave_OnClick(object sender, EventArgs e) { if (!ValidateForm()) { return; } else { if (Request.QueryString["id"] == null) { f = FlagReasons.NewFlagReasons(); f.DateCreatedString = DateTime.Now.ToString(); } else { f = FlagReasons.GetFlagReasons(new Guid(Request.QueryString["id"])); f.DateModifiedString = DateTime.Now.ToString(); } f.Bodyname = txtBodyName.Text; f.IsActive = chkIsActive.Checked; if (chkHasOther.Checked) { f.isHasOther = true; f.Description = ""; } else if (!chkHasOther.Checked) { f.isHasOther = false; f.Description = txtDescription.Text; } if (f.IsValid) { f.Save(); Response.Redirect("FlagReasonCMSList.aspx"); } } }