/// <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(); }
/// <summary> /// Handles the Init event of the control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void m_Control_Init(object sender, EventArgs e) { var options = ((MultipleTextstringPrevalueEditor)this.PrevalueEditor).GetPreValueOptions <MultipleTextstringOptions>(); if (options == null) { // load defaults options = new MultipleTextstringOptions(true); } // check if the data value is available... if (this.Data.Value != null) { // set the value of the control this.m_Control.Values = this.Data.Value.ToString(); } // set the controls options this.m_Control.Options = options; }