Hi Stormcadi,
As far as I know, you should do some modifications on your WebService.You should add a field to your tabel which get the datas from. This field indicates that if it is the default selected item under some condition(Based on the former CascadingDropDown's selection).
[WebMethod]
public CascadingDropDownNameValue[] GetCities(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int stateID;
if (!kv.ContainsKey("State") || !Int32.TryParse(kv["State"], out stateID))
{
return null;
}
List<CascadingDropDownNameValue> myList = new List<CascadingDropDownNameValue>();
strSql = "SELECT * FROM tb_City WHERE StateID=" + stateID.ToString();
GetDr(strSql);
while (myReader.Read())
{
if (myReader["isDefault"].ToString() =="true")
{
myList.Add(new CascadingDropDownNameValue(myReader["CityName"].ToString(), myReader["CityID"].ToString(),true));
}
else {
myList.Add(new CascadingDropDownNameValue(myReader["CityName"].ToString(), myReader["CityID"].ToString(),false));
}
}
myReader.Close();
return myList.ToArray();
}
Please remove the CascadingDropDown's PromptText property. For example,
<cc1:CascadingDropDown ID="CascadingDropDown2" BehaviorID="myCDECity" runat="server" TargetControlID="dlCity" ParentControlID="dlState"
Category="City" ServicePath="../WebService/CityServiceOledb.asmx"
ServiceMethod="GetCities" LoadingText="Load Text....">
</cc1:CascadingDropDown>
Best regards,
Jonathan