Hi, I have created a webpage with two drop down boxes.
Continent: <asp:DropDownList ID="ddlContinent" runat="server" /><ajaxToolkit:CascadingDropDown ID="cddcontinent" runat="server" TargetControlID="ddlContinent" Category="Continent" ServicePath="Helper.asmx" ServiceMethod="GetContinents" /><br /> Country: <asp:DropDownList ID="ddlCountry" runat="server" /><ajaxToolkit:CascadingDropDown ID="ccdCountry" runat="server" TargetControlID="ddlCountry" ParentControlID="ddlContinent" Category="country" ServicePath="Helper.asmx" ServiceMethod="GetCountries" /><br />
I've also created a webservice (section of it below)
<WebMethod> _ Public Function GetContinents(knownCategoryValues As String, category As String) As CascadingDropDownNameValue() Dim Sql As Object Dim MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & Server.MapPath("\App_data\MyDayabase.mdb")) MyConnection.Open() Sql = " SELECT ContinentName, ContinentID FROM Continents " Dim dbcomm As New OleDbDataAdapter(Sql, MyConnection) Dim values As New List(Of CascadingDropDownNameValue)() Dim dt As New DataTable() dbcomm.Fill(dt) For Each dr As DataRow In dt.Rows Dim continent As String = DirectCast(dr("ContinentName"), String) Dim continentId As Integer = CInt(dr("ContinentID")) values.Add(New CascadingDropDownNameValue(continent, continentId.ToString())) Next Return values.ToArray() End Function
What I have been really struggling with though is the second part of the webservice to populate the second drop box.
I have two tables in my database
Continents
ContinentID, ContinentName
1, Europe
2, Asia
Countries
CountryID, ContinentID, CountryName
1, 1, England
2, 1, France
3, 2, Japan
4, 2, China
Please could someone help as to what I should put for GetCountries
Thanks Very Much