/// <summary> /// Saves this instance. /// </summary> public override void Save() { // set the options var options = new MultipleTextstringOptions(true); // parse the maximum int maximum; if (int.TryParse(this.TextBoxMaximum.Text, out maximum)) { if (maximum == 0) { maximum = -1; } options.Maximum = maximum; } // parse the minimum int minimum; if (int.TryParse(this.TextBoxMinimum.Text, out minimum)) { if (minimum == 0) { minimum = -1; } options.Minimum = minimum; } // 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<MultipleTextstringOptions>(); // no options? use the default ones. if (options == null) { options = new MultipleTextstringOptions(true); } // set the values this.TextBoxMaximum.Text = options.Maximum.ToString(); this.TextBoxMinimum.Text = options.Minimum.ToString(); }