[WebMethod]
[System.Web.Script.Service
s.ScriptMe
thod]
public AjaxControlToolkit.Cascadi
ngDropDown
NameValue[
] GetCountries(string knownCategoryValues, string category)
{
List<CascadingDropDownName
Value> countryList = new List<CascadingDropDownName
Value>();
DataSet dsCountry = Country.GetCountries();
foreach (DataRow row in dsCountry.Tables[0].Rows)
{
countryList.Add(new CascadingDropDownNameValue
(row["Coun
try"].ToSt
ring(), row["CountryID"].ToString(
)));
}
return countryList.ToArray();
}
// register.ascx
//////////////////////////
//////////
//////////
//////////
//////////
/
Country:
<asp:Image ID="imgFlagRegister" runat="server" Height="12px" Width="23px" /><br />
<asp:DropDownList style="position: static" Font-Size="Smaller" Font-Bold="true" Width="190px" ID="ddlCountryRegister" runat="server"></asp:DropD
ownList>
<ajaxToolkit:CascadingDrop
Down ID="cddCountryRegister" runat="server"
TargetControlID="ddlCountr
yRegister"
BehaviorID="myCDECountryRe
gister"
Category="Country"
PromptText="Choose a Country"
LoadingText="[Loading Countries...]"
ServicePath="../LocationSe
rvice.asmx
"
ServiceMethod="GetCountrie
s" Enabled="True" />
// search.ascx
<asp:Image ID="imgFlagSearch" runat="server" Height="12px" Width="23px" /><br />
<asp:DropDownList style="position: static" Font-Size="Smaller" Font-Bold="true" Width="190px" ID="ddlCountrySearch" runat="server"></asp:DropD
ownList>
<ajaxToolkit:CascadingDrop
Down ID="cddCountrySearch" runat="server"
TargetControlID="ddlCountr
ySearch" BehaviorID="myCDECountrySe
arch"
Category="Country"
PromptText="Choose a Country"
LoadingText="[Loading Countries...]"
ServicePath="../LocationSe
rvice.asmx
"
ServiceMethod="GetCountrie
s" Enabled="True" />
Start Free Trial