User758457977 posted
Greetings. I have two drop down lists and one of them has an associated CascadingDropDownList control associated with it:
ddlFieldA
ddlFieldB
ccdFieldB
I also have a RequiredFieldValidator targeted at ddlFieldB.
When a user selects an item in ddlFieldA, ccdFieldB uses a web service to populate ddlFieldB. I'm using the following method in the web service (pseudocode):
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
if(someConditionExists)
{
//I'm using true to set this as the default value
values.Add(new CascadingDropDownNameValue("First Value", "First Value", true);
}
LoadOtherValuesFromDB(values);
The drop down list is being populated correctly, and if(someConditionExists), the text in the FieldB drop down list is displayed as "First Value". My problem is that, although the text is displaying correctly in ddlFieldB if(someConditionExists), it
appears that its selectedValue must still be set to null because the RequiredField validator shows the "*" sign next to ddlFieldB after the above code is executed. I need the selected value to be set so the RequiredField validator isn't activated after
the call to populate the drop down list. Any thoughts? Thanks.