public DynamicDropDownList(DynamicDropDownListXml xml) { _dropdown = new DropDownList(); _dropdown.CausesValidation = false; _required = new RequiredFieldValidator(); _required.Display = ValidatorDisplay.Dynamic; _required.EnableClientScript = true; _required.Text = "*"; _required.Enabled = false; _required.ClientIDMode = System.Web.UI.ClientIDMode.Static; this.Controls.Add(_dropdown); this.Controls.Add(_required); this.ID = xml.Name; this.IsRequired = xml.IsRequired; this.ErrorMessage = xml.ErrorMessage; this.ValidationGroup = xml.ValidationGroup; this.FilterId = xml.FilterId; if (!string.IsNullOrEmpty(xml.SelectedValue)) { _dropdown.SelectedValue = xml.SelectedValue; _selectedValueOnLoad = xml.SelectedValue; } this.controlXML = xml; this.Visible = xml.Visible; }
public DynamicDropDownList() { controlXML = new DynamicDropDownListXml(); _dropdown = new DropDownList(); _dropdown.CausesValidation = false; _required = new RequiredFieldValidator(); _required.Display = ValidatorDisplay.Dynamic; _required.EnableClientScript = true; _required.Text = "*"; _required.Enabled = false; this.Controls.Add(_dropdown); this.Controls.Add(_required); }