/// <summary> /// Saves the data-type PreValue options. /// </summary> public override void Save() { // set the options var options = new TB_Options() { DefaultValue = this.DefaultValue.Checked, OffBackgroundColor = this.OffBackgroundColor.Text, OffText = this.OffText.Text, OnBackgroundColor = this.OnBackgroundColor.Text, OnText = this.OnText.Text }; // save the options as JSON this.SaveAsJson(options); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // get PreValues, load them into the controls. var options = this.GetPreValueOptions <TB_Options>(); // if the options are null, then load the defaults if (options == null) { options = new TB_Options(true); } // set the values this.DefaultValue.Checked = options.DefaultValue; this.OffBackgroundColor.Text = options.OffBackgroundColor; this.OffText.Text = options.OffText; this.OnBackgroundColor.Text = options.OnBackgroundColor; this.OnText.Text = options.OnText; }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); // get PreValues, load them into the controls. var options = this.GetPreValueOptions<TB_Options>(); // if the options are null, then load the defaults if (options == null) options = new TB_Options(true); // set the values this.DefaultValue.Checked = options.DefaultValue; this.OffBackgroundColor.Text = options.OffBackgroundColor; this.OffText.Text = options.OffText; this.OnBackgroundColor.Text = options.OnBackgroundColor; this.OnText.Text = options.OnText; }