/// <summary> /// Saves the data-type PreValue options. /// </summary> public override void Save() { // set the options var options = new ETB_Options(true) { Css = this.TextBoxCss.Text }; // parse the height int height, width; if (int.TryParse(this.TextBoxHeight.Text, out height)) { if (height == 0) { height = 400; } options.Height = height; } // parse the width if (int.TryParse(this.TextBoxWidth.Text, out width)) { if (width == 0) { width = 490; } options.Width = width; } // save the options as JSON this.SaveAsJson(options); // re-add the CSS styles (again) this.Preview.Height = Unit.Pixel(options.Height); this.Preview.Width = Unit.Pixel(options.Width); this.Preview.Attributes.Add("style", options.Css); }
/// <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 <ETB_Options>(); // no options? use the default ones. if (options == null) { options = new ETB_Options(true); } // set the values this.TextBoxCss.Text = options.Css; this.TextBoxHeight.Text = options.Height.ToString(); this.Preview.TextMode = TextBoxMode.MultiLine; this.Preview.Attributes.Add("style", options.Css); this.Preview.Height = Unit.Pixel(options.Height); this.Preview.Width = Unit.Pixel(options.Width); this.TextBoxWidth.Text = options.Width.ToString(); }
/// <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<ETB_Options>(); // no options? use the default ones. if (options == null) { options = new ETB_Options(true); } // set the values this.TextBoxCss.Text = options.Css; this.TextBoxHeight.Text = options.Height.ToString(); this.Preview.TextMode = TextBoxMode.MultiLine; this.Preview.Attributes.Add("style", options.Css); this.Preview.Height = Unit.Pixel(options.Height); this.Preview.Width = Unit.Pixel(options.Width); this.TextBoxWidth.Text = options.Width.ToString(); }