protected override void CreateChildControls() { Controls.Clear(); var selectedItemPanel = new Panel { CssClass = "selected-item" }; _selectedValue = new HtmlAnchor { HRef = "javascript:void(0);", Title = LocalizeString("DropDownList.SelectedItemExpandTooltip") }; _selectedValue.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "selected-value"); selectedItemPanel.Controls.Add(_selectedValue); Controls.Add(selectedItemPanel); _stateControl = new DnnGenericHiddenField <DnnDropDownListState> { ID = "state" }; _stateControl.ValueChanged += (sender, args) => OnSelectionChanged(EventArgs.Empty); Controls.Add(_stateControl); }
protected override void CreateChildControls() { Controls.Clear(); var selectedItemPanel = new Panel { CssClass = "selected-item" }; _selectedValue = new HtmlAnchor { HRef = "javascript:void(0);", Title = LocalizeString("DropDownList.SelectedItemExpandTooltip") }; _selectedValue.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "selected-value"); selectedItemPanel.Controls.Add(_selectedValue); Controls.Add(selectedItemPanel); var dropDownListPanel = new Panel { CssClass = "dt-container" }; var header = new Panel { CssClass = "dt-header" }; var sortButton = new HtmlAnchor { HRef = "javascript:void(0);", Title = LocalizeString("DropDownList.SortAscendingButtonTooltip"), }; var sortTitle = new Literal { Text = string.Format(@"<span>{0}</span>", HttpUtility.HtmlEncode(LocalizeString("DropDownList.SortAscendingButtonTitle"))) }; sortButton.Controls.Add(sortTitle); sortButton.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "sort-button"); header.Controls.Add(sortButton); var searchPanel = new Panel { CssClass = "search-container" }; var searchInputContainer = new Panel { CssClass = "search-input-container" }; var searchInput = new HtmlInputText(); searchInput.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "search-input"); searchInput.Attributes.Add(HtmlTextWriterAttribute.AutoComplete.ToString(), "off"); searchInput.Attributes.Add(HtmlTextWriterAttribute.Maxlength.ToString(), "200"); searchInput.Attributes.Add("placeholder", LocalizeString("DropDownList.SearchInputPlaceHolder")); searchInputContainer.Controls.Add(searchInput); searchPanel.Controls.Add(searchInputContainer); var clearButton = new HtmlAnchor { HRef = "javascript:void(0);" }; clearButton.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "clear-button"); clearButton.Attributes.Add(HtmlTextWriterAttribute.Title.ToString(), LocalizeString("DropDownList.ClearButtonTooltip")); clearButton.Style.Add(HtmlTextWriterStyle.Display, "none"); searchPanel.Controls.Add(clearButton); var searchButton = new HtmlAnchor { HRef = "javascript:void(0);" }; searchButton.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "search-button"); searchButton.Attributes.Add(HtmlTextWriterAttribute.Title.ToString(), LocalizeString("DropDownList.SearchButtonTooltip")); searchPanel.Controls.Add(searchButton); header.Controls.Add(searchPanel); dropDownListPanel.Controls.Add(header); var contentPanel = new Panel { CssClass = "dt-content" }; var treePanel = new Panel { CssClass = "dt-tree" }; contentPanel.Controls.Add(treePanel); dropDownListPanel.Controls.Add(contentPanel); var footer = new Panel { CssClass = "dt-footer" }; var resultText = new Literal { Text = string.Format(@"<span class=""{0}""><b></b>{1}</span>", "result", HttpUtility.HtmlEncode(" " + LocalizeString("DropDownList.Results"))) }; footer.Controls.Add(resultText); var resizer = new Panel { CssClass = "resizer" }; footer.Controls.Add(resizer); dropDownListPanel.Controls.Add(footer); Controls.Add(dropDownListPanel); _stateControl = new DnnGenericHiddenField <DnnDropDownListState> { ID = "state" }; _stateControl.ValueChanged += (sender, args) => OnSelectionChanged(EventArgs.Empty); Controls.Add(_stateControl); }