/// <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 <TextstringArrayOptions>(); // no options? use the default ones. if (options == null) { options = new TextstringArrayOptions(true); } // set the values this.CheckBoxShowColumnLabels.Checked = options.ShowColumnLabels; this.MtcColumnLabels.Options = new MultipleTextstringOptions() { Minimum = options.ItemsPerRow }; this.MtcColumnLabels.Values = options.ColumnLabels; this.TextBoxMaximumRows.Text = options.MaximumRows.ToString(); this.TextBoxMinimumRows.Text = options.MinimumRows.ToString(); this.CheckBoxDisableSorting.Checked = options.DisableSorting; }
/// <summary> /// Saves this instance. /// </summary> public override void Save() { // set the options var options = new TextstringArrayOptions(true); // save the column label options options.ShowColumnLabels = this.CheckBoxShowColumnLabels.Checked; options.ColumnLabels = this.MtcColumnLabels.Values; // parse the number of items per row; based on the number of labels. int itemsPerRow = options.ColumnLabels.Split(new[] { Environment.NewLine }, StringSplitOptions.None).Length; if (itemsPerRow == 0) { itemsPerRow = 2; } options.ItemsPerRow = itemsPerRow; options.DisableSorting = this.CheckBoxDisableSorting.Checked; // parse the maximum rows int maximumRows; if (int.TryParse(this.TextBoxMaximumRows.Text, out maximumRows)) { if (maximumRows == 0) { maximumRows = -1; } options.MaximumRows = maximumRows; } // parse the minimum rows int minimumRows; if (int.TryParse(this.TextBoxMinimumRows.Text, out minimumRows)) { if (minimumRows == 0) { minimumRows = -1; } options.MinimumRows = minimumRows; } // save the options as JSON this.SaveAsJson(options); }
/// <summary> /// Initializes a new instance of the <see cref="TextstringArrayData" /> class. /// </summary> /// <param name="dataType">Type of the data.</param> /// <param name="options">The options.</param> public TextstringArrayData(BaseDataType dataType, TextstringArrayOptions options) : base(dataType) { this.options = options; }
/// <summary> /// Initializes a new instance of the <see cref="TextstringArrayData"/> class. /// </summary> /// <param name="dataType">Type of the data.</param> public TextstringArrayData(BaseDataType dataType, TextstringArrayOptions options) : base(dataType) { this.options = options; }
/// <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) { // 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 = this.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<TextstringArrayOptions>(); // no options? use the default ones. if (options == null) { options = new TextstringArrayOptions(true); } // set the values this.CheckBoxShowColumnLabels.Checked = options.ShowColumnLabels; this.MtcColumnLabels.Options = new MultipleTextstringOptions() { Minimum = options.ItemsPerRow }; this.MtcColumnLabels.Values = options.ColumnLabels; this.TextBoxMaximumRows.Text = options.MaximumRows.ToString(); this.TextBoxMinimumRows.Text = options.MinimumRows.ToString(); this.CheckBoxDisableSorting.Checked = options.DisableSorting; }