How to validate an ajax combobox with empty text?
How sh开发者_运维知识库ould I validate if my AJAX ComboBox
contains text? I have tried with the ASP.NET RequiredFieldValidator
but it dosen't work.
If found a solution here: http://ajaxcontroltoolkit.codeplex.com/workitem/24417
Had to add javascript to change the controltovalidate property for the internal textbox.
string script = string.Format(@"if({0}) {0}.controltovalidate = ""{1}_TextBox"";", this.reqValidator.ClientID, this.ddlCombo.ClientID);
ScriptManager.RegisterStartupScript(this, this.GetType(), string.Format("validator trick for {0}", this.ClientID), script, true);
精彩评论