Im using the popupextender on a form. Its an autocompletion routine that works well.
Client starts typing in the city and a list of cities appears - client then selects from the list and the selected city appears in the targetid textbox "TBAutoCompleteTo" as advertised. I have anouther textbox TBZipTO which I want to populate with the zipcode belonging to the selected city.
Can somone point me in the right direction?
Thanks
-dan
The function is use to populate the array im passing back is like this:
The extendor look slike this.
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="TBAutoCompleteTo" ServicePath="autocomplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="3" CompletionSetCount="12" EnableCaching="true" >
</ajaxToolkit:AutoCompleteExtender>
Client starts typing in the city and a list of cities appears - client then selects from the list and the selected city appears in the targetid textbox "TBAutoCompleteTo" as advertised. I have anouther textbox TBZipTO which I want to populate with the zipcode belonging to the selected city.
Can somone point me in the right direction?
Thanks
-dan
The function is use to populate the array im passing back is like this:
Code:
<WebMethod()> _
Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
Dim Mycity As String = Nothing
Dim conn As New MySqlConnection(System.Configuration.ConfigurationManager.AppSettings("connStringmysql"))
If conn.State = Data.ConnectionState.Closed Then conn.Open()
Dim cmd As New MySqlCommand
Dim DR As MySqlDataReader
With cmd
.Connection = conn
.CommandText = ("select city,areacode, zipcoe from zipcodes where City Like '" & prefixText & "%' and state = 'TN'")
End With
Try
DR = cmd.ExecuteReader
Catch ex As Exception
End Try
Dim items As New List(Of String)
While DR.Read
Mycity = DR(0)
items.Add(Mycity & " Area Code " & DR(1).ToString)
End While
conn.Close()
conn.Dispose()
Return items.ToArray()
End Function
The extendor look slike this.
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="TBAutoCompleteTo" ServicePath="autocomplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="3" CompletionSetCount="12" EnableCaching="true" >
</ajaxToolkit:AutoCompleteExtender>