Hi,
I am using following code return two values while using ajax autocomplete but I want to return 4 values please help me my code as follows.
----default.aspx
function ClientItemSelected(sender, e) {
$get("<%=hfCustomerId.ClientID %>").value = e.get_value();
}
</script>
<System.Web.Script.Services.ScriptMethod(), _
System.Web.Services.WebMethod()> _
Public Shared Function SearchCustomers(ByVal prefixText As String, ByVal count As Integer) As List(Of String)
Dim conn As SqlConnection = New SqlConnection
conn.ConnectionString = ConfigurationManager.ConnectionStrings("SQLConnection").ConnectionString
Dim cmd As SqlCommand = New SqlCommand
cmd.CommandText = "select CustomerId, ContactName from Customers where" & _
" ContactName like @SearchText + '%'"
cmd.Parameters.AddWithValue("@SearchText", prefixText)
cmd.Connection = conn
conn.Open()
Dim customers As List(Of String) = New List(Of String)
Dim sdr As SqlDataReader = cmd.ExecuteReader
While sdr.Read
Dim item As String = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(sdr("ContactName").ToString, sdr("CustomerId").ToString)
customers.Add(item)
End While
conn.Close()
Return customers
End Function
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
TextBox1.Text = Request.Form(hfCustomerId.UniqueID)
TextBox2.Text = Request.Form(txtCustomer.UniqueID)
End Sub