protected void gvFAQ_RowUpdating(object sender, GridViewUpdateEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } Controls_mfbHtmlEdit t = (Controls_mfbHtmlEdit)gvFAQ.Rows[e.RowIndex].FindControl("txtAnswer"); sqlFAQ.UpdateParameters["Answer"] = new Parameter("Answer", System.Data.DbType.String, t.FixedHtml); }
protected void fvClub_ItemUpdating(object sender, FormViewUpdateEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } Page.Validate("valEditClub"); if (Page.IsValid) { Club c = ActiveClub ?? new Club(); c.City = (string)e.NewValues["City"]; c.ContactPhone = (string)e.NewValues["ContactPhone"]; c.Country = (string)e.NewValues["Country"]; c.Description = Controls_mfbHtmlEdit.FixHtml((string)e.NewValues["Description"]); c.HomeAirportCode = (string)e.NewValues["HomeAirportCode"]; if (!String.IsNullOrEmpty(c.HomeAirportCode)) { AirportList al = new AirportList(c.HomeAirportCode); List <airport> lst = new List <airport>(al.GetAirportList()); airport ap = lst.FirstOrDefault(a => a.IsPort); c.HomeAirportCode = ap == null ? c.HomeAirportCode : ap.Code; } c.Name = (string)e.NewValues["Name"]; c.StateProvince = (string)e.NewValues["StateProvince"]; c.URL = (string)e.NewValues["URL"]; c.ID = Convert.ToInt32(e.NewValues["ID"], CultureInfo.InvariantCulture); c.RestrictEditingToOwnersAndAdmins = Convert.ToBoolean(e.NewValues["RestrictEditingToOwnersAndAdmins"], CultureInfo.InvariantCulture); c.IsPrivate = Convert.ToBoolean(e.NewValues["IsPrivate"], CultureInfo.InvariantCulture); c.PrependsScheduleWithOwnerName = Convert.ToBoolean(e.NewValues["PrependsScheduleWithOwnerName"], CultureInfo.InvariantCulture); c.DeleteNotifications = (Club.DeleteNoficiationPolicy)Enum.Parse(typeof(Club.DeleteNoficiationPolicy), (string)e.NewValues["DeleteNotifications"]); c.DoubleBookRoleRestriction = (Club.DoubleBookPolicy)Enum.Parse(typeof(Club.DoubleBookPolicy), (string)e.NewValues["DoubleBookRoleRestriction"]); c.AddModifyNotifications = (Club.AddModifyNotificationPolicy)Enum.Parse(typeof(Club.AddModifyNotificationPolicy), (string)e.NewValues["AddModifyNotifications"]); c.TimeZone = TimeZoneInfo.FindSystemTimeZoneById((string)e.NewValues["TimeZone.Id"]); if (c.IsNew) { c.Creator = Page.User.Identity.Name; } if (c.FCommit()) { if (ClubChanged != null) { ClubChanged(this, new ClubChangedEventsArgs(ActiveClub)); } this.ActiveClub = c; } else { lblErr.Text = c.LastError; } } }
public void Refresh() { Club c = ActiveClub; if (c == null) { return; } // Hack - page_load isn't getting called on mfbhtmlEdit, need to fix up the HTML here. string szDesc = c.Description; if (fvClub.CurrentMode == FormViewMode.Edit) { c.Description = Controls_mfbHtmlEdit.UnFixHtml(c.Description); } fvClub.DataSource = new List <Club> { c }; fvClub.DataBind(); // Restore the description c.Description = szDesc; // Show the link or don't if (fvClub.CurrentMode == FormViewMode.ReadOnly) { MultiView mv = (MultiView)fvClub.FindControl("mvClubHeader"); if (mv != null) { mv.ActiveViewIndex = (LinkToDetails ? 0 : 1); } } else { Button b = (Button)fvClub.FindControl("btnCancel"); b.Visible = ShowCancel; b = (Button)fvClub.FindControl("btnDelete"); b.Visible = ShowDelete; } }