Expand|Select|Wrap|Line Numbers
- Imports System.Web
- Imports System
- Imports System.Collections.Specialized
- Imports System.Web.Services
- Imports System.Web.Services.Protocols
- Imports System.Data
- Imports AjaxControlToolkit
- Imports System.Data.SqlClient
- Imports System.Collections.Generic
- ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
- <System.Web.Script.Services.ScriptService()> _
- <WebService(Namespace:="http://tempuri.org/")> _
- <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
- <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
- Public Class CountryServiceInherits System.Web.Services.WebService
- <System.Web.Services.WebMethod()> _
- Public Function GetMakes(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
- Dim countrymakeadaptor As New datacountryTableAdapters.CountryTableAdapter()
- Dim makevalues As New List(Of CascadingDropDownNameValue)()
- For Each row As DataRow In countrymakeadaptor.GetAllCountries()
- makevalues.Add(New CascadingDropDownNameValue(row("COUNTRY").ToString(), row("ID").ToString()))
- Next
- Return makevalues.ToArray()
- End Function
- <WebMethod()> _
- Public Function GetCity(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue()
- Dim kv As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
- Dim citymakeadaptor As New DatacityTableAdapters.CitiesTableAdapter()
- Dim cityvalues As New List(Of CascadingDropDownNameValue)()
- For Each row As DataRow In citymakeadaptor.GetAllCities(CLng(kv.Values(0).ToString))
- cityvalues.Add(New CascadingDropDownNameValue(row("CITIES").ToString(), row("CID").ToString()))
- Next
- Return cityvalues.ToArray()
- End Function
- End Class
Expand|Select|Wrap|Line Numbers
- <asp:DropDownList ID="DropDownList1" runat="server" Height="34px" Width="199px">
- </asp:DropDownList>
- <br />
- <cc1:CascadingDropDown ID="DropDownList1_CascadingDropDown"
- runat="server"
- Enabled="True"
- TargetControlID="DropDownList1"
- category="Country"
- PromptText="Select the country"
- LoadingText ="Please wait...."
- ServicePath="~/countryservice.asmx"
- ServiceMethod="GetMakes">
- </cc1:CascadingDropDown>
- <br />
- <asp:DropDownList ID="DropDownList2" runat="server" Height="31px" Width="197px">
- </asp:DropDownList>
- <cc1:CascadingDropDown ID="DropDownList2_CascadingDropDown"
- runat="server"
- Enabled="True"
- TargetControlID="DropDownList2"
- ParentControlID="DropDownList1"
- category="Cities"
- PromptText="Select the City"
- LoadingText ="Please wait...."
- ServicePath="~/countryservice.asmx"
- ServiceMethod="GetCity"
- EnableViewState="True">
- </cc1:CascadingDropDown>