/// <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 <CharLimitOptions>();

            // no options? use the default ones.
            if (options == null)
            {
                options = new CharLimitOptions(true);
            }

            // set the values
            this.CharLimitValue.Text                   = options.Limit.ToString();
            this.TextBoxModeList.SelectedValue         = options.TextBoxMode.ToString();
            this.CheckBoxEnforceCharacterLimit.Checked = options.EnforceCharLimit;
        }
        /// <summary>
        /// Saves the data-type PreValue options.
        /// </summary>
        public override void Save()
        {
            // set the options
            var options = new CharLimitOptions(true);

            // parse the char limit
            int limit;

            if (int.TryParse(this.CharLimitValue.Text, out limit))
            {
                if (limit == 0)
                {
                    limit = 100;
                }

                options.Limit = limit;
            }

            // set the TextBoxMode
            if (this.TextBoxModeList.SelectedValue == "MultiLine")
            {
                options.TextBoxMode = TextBoxMode.MultiLine;
            }
            else
            {
                options.TextBoxMode = TextBoxMode.SingleLine;
            }

            if (this.CheckBoxEnforceCharacterLimit.Checked)
            {
                options.EnforceCharLimit = true;
            }
            else
            {
                options.EnforceCharLimit = false;
            }

            // save the options as JSON
            this.SaveAsJson(options);
        }
        /// <summary>
        /// Saves the data-type PreValue options.
        /// </summary>
        public override void Save()
        {
            // set the options
            var options = new CharLimitOptions(true);

            // parse the char limit
            int limit;
            if (int.TryParse(this.CharLimitValue.Text, out limit))
            {
                if (limit == 0)
                {
                    limit = 100;
                }

                options.Limit = limit;
            }

            // set the TextBoxMode
            if (this.TextBoxModeList.SelectedValue == "MultiLine")
            {
                options.TextBoxMode = TextBoxMode.MultiLine;
            }
            else
            {
                options.TextBoxMode = TextBoxMode.SingleLine;
            }

            if (this.CheckBoxEnforceCharacterLimit.Checked)
            {
                options.EnforceCharLimit = true;
            }
            else
            {
                options.EnforceCharLimit = false;
            }

            // 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<CharLimitOptions>();

            // no options? use the default ones.
            if (options == null)
            {
                options = new CharLimitOptions(true);
            }

            // set the values
            this.CharLimitValue.Text = options.Limit.ToString();
            this.TextBoxModeList.SelectedValue = options.TextBoxMode.ToString();
            this.CheckBoxEnforceCharacterLimit.Checked = options.EnforceCharLimit;
        }