protected override void CreateChildControls() { base.CreateChildControls(); _textBox = new TextBox(); _textBox.ID = "Text"; _textBox.Columns = 50; this.Controls.Add(_textBox); _browseButton = new Button(); _browseButton.Text = "Browse"; this.Controls.Add(_browseButton); ConfigurationForm form = ConfigurationControlUtility.Instance().GetCurrentConfigurationForm(this); if (form != null) { _validator = new CustomValidator(); _validator.ID = "Validator"; _validator.ControlToValidate = _textBox.ID; _validator.ErrorMessage = form.InvalidUrlErrorMessage; this.Controls.Add(_validator); _validator.ServerValidate += new ServerValidateEventHandler(DefaultUrlControl_ServerValidate); } _textBox.TextChanged += new EventHandler(DefaultUrlControl_TextChanged); }
protected override void CreateChildControls() { base.CreateChildControls(); TextBox = new TextBox { ID = "Text" }; Controls.Add(TextBox); if (ConfigurationControlUtility.Instance().GetCurrentConfigurationForm(this) != null && !string.IsNullOrWhiteSpace(ValidationRegEx)) { regExVal = new RegularExpressionValidator { ID = "Validator", ControlToValidate = TextBox.ID, ValidationExpression = ValidationRegEx, ErrorMessage = ValidationError, Text = "<span class=\"field-item-validation\">*</span>" }; Controls.Add(regExVal); } TextBox.TextChanged += TextChanged; }