Example #1
0
        /// <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 <FileDropDownListOptions>();

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

            // set the values
            this.TextBoxDirectory.Text          = options.Directory;
            this.TextBoxSearchPattern.Text      = options.SearchPattern;
            this.CheckBoxUseDirectories.Checked = options.UseDirectories;
        }
        /// <summary>
        /// Saves this instance.
        /// </summary>
        public override void Save()
        {
            // check if the 'search pattern' is empty, set it to wildcard.
            var searchPattern = this.TextBoxSearchPattern.Text;
            if (string.IsNullOrEmpty(searchPattern))
            {
                searchPattern = "*";
            }

            // set the options
            var options = new FileDropDownListOptions(true)
            {
                Directory = this.TextBoxDirectory.Text,
                SearchPattern = searchPattern,
                UseDirectories = this.CheckBoxUseDirectories.Checked
            };

            // save the options as JSON
            this.SaveAsJson(options);
        }
Example #3
0
        /// <summary>
        /// Saves this instance.
        /// </summary>
        public override void Save()
        {
            // check if the 'search pattern' is empty, set it to wildcard.
            var searchPattern = this.TextBoxSearchPattern.Text;

            if (string.IsNullOrEmpty(searchPattern))
            {
                searchPattern = "*";
            }

            // set the options
            var options = new FileDropDownListOptions(true)
            {
                Directory      = this.TextBoxDirectory.Text,
                SearchPattern  = searchPattern,
                UseDirectories = this.CheckBoxUseDirectories.Checked
            };

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

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

            // set the values
            this.TextBoxDirectory.Text = options.Directory;
            this.TextBoxSearchPattern.Text = options.SearchPattern;
            this.CheckBoxUseDirectories.Checked = options.UseDirectories;
        }