This project is read-only.


Validator not working for ajaxToolkit combobox.


I want to validate ajaxToolkit combobox via RequiredFieldValidator or Custome Javascript.

RequiredFieldValidator not getting i use following javascript for validation.
I dont know is the correct way to do this or any other better option available.

var _ddlPreDepartment=document.getElementById('<%=ddlPreDepartment.ClientID %>');

if (_ddlPreDepartment != null && _ddlPreDepartment != 'undefined' && _ddlPreDepartment.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].value.toLowerCase() == "select") {
    alert('Please select Department.');
    return false;
Closed May 15, 2015 at 3:54 PM by fadilmamedov
Workaround found, see comments.


typ wrote Jun 25, 2010 at 12:40 PM

Due to a real nature of the combobox control (in fact it is a textbox inside a table), I made it with this on PreRender:

string script = string.Format(
{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);
The script is registered right after validators default definition, so we're going to change it...


foster1890 wrote Mar 22, 2011 at 9:59 PM

An easier way to work around this issue is to set the required field validator's ControlToValidate property to the combo box's ID followed by "$TextBox" (i.e. ControlToValidate="comboBox$TextBox"). This will force the required field validator's client side script to validate the text box.