Exemplo n.º 1
0
        private string BuildTabLB(bool rebuilding = false)
        {
            var stb = new StringBuilder();
            var lb  = new clsJQuery.jqListBox("lb", this.PageName);

            var ms1  = new clsJQuery.jqMultiSelect("ms1", this.PageName, true);
            var ms2  = new clsJQuery.jqMultiSelect("ms2", this.PageName, false);
            var sel  = new clsJQuery.jqSelector("sel", this.PageName, false);
            var sel2 = new clsJQuery.jqSelector("sel2", this.PageName, false);

            ms2.width = 300;
            ms2.Size  = 6;
            lb.style  = "height:100px;width:300px;";

            foreach (var item in _lbList)
            {
                lb.items.Add(item);
                ms1.AddItem(item, item, false);
                ms2.AddItem(item, item, false);
                sel.AddItem(item, item, false);
            }


            stb.Append(PageBuilderAndMenu.clsPageBuilder.FormStart("frmTab1", "ListBox", "Post"));
            stb.Append(sel.Build() + ms1.Build() + ms2.Build() + "<br>");
            stb.Append(lb.Build() + " " + BuildTextbox("TextboxLB") + " " + BuildButton("ButtonLB"));
            stb.Append(sel2.Build() + "<br>");

            stb.Append(PageBuilderAndMenu.clsPageBuilder.FormEnd());
            if (rebuilding)
            {
                this.divToUpdate.Add("TabLB_div", stb.ToString());
            }
            return(stb.ToString());
        }
        /// <summary>
        ///     Return the string required to create a web page list box.
        /// </summary>
        protected string FormListBox(string name,
                                     NameValueCollection options,
                                     int selected         = -1,
                                     string selectedValue = "",
                                     int width            = 150,
                                     bool enabled         = true)
        {
            var lb = new clsJQuery.jqListBox(name, PageName);

            lb.items.Clear();
            lb.id      = $"o{name}";
            lb.style   = $"width: {width}px;";
            lb.enabled = enabled;

            if (options != null)
            {
                for (var i = 0; i < options.Count; i++)
                {
                    if (selected == -1 && selectedValue == options.GetKey(i))
                    {
                        selected = i;
                    }
                    lb.items.Add(options.GetKey(i));
                }

                if (selected >= 0)
                {
                    lb.SelectedValue = options.GetKey(selected);
                }
            }

            return(lb.Build());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Return the string required to create a web page list box.
        /// </summary>
        protected string FormListBox(string Name, ref NameValueCollection Options, int Selected = -1, string SelectedValue = "", int Width = 150, bool Enabled = true)
        {
            clsJQuery.jqListBox lb = new clsJQuery.jqListBox(Name, PageName);

            lb.items.Clear();
            lb.id      = "o" + Name;
            lb.style   = "width: " + Width + "px;";
            lb.enabled = Enabled;

            if (Options != null)
            {
                for (int i = 0; i < Options.Count; i++)
                {
                    if ((Selected == -1) && (SelectedValue == Options.GetKey(i)))
                    {
                        Selected = i;
                    }
                    lb.items.Add(Options.GetKey(i));
                }
                if (Selected >= 0)
                {
                    lb.SelectedValue = Options.GetKey(Selected);
                }
            }

            return(lb.Build());
        }