Additional functionality in AJAX AutoComplete Extender control

J

jonefer

Is there a way to place column headers in the AutoCompleteExtender control?

I'd like to eventually add more functionality, such as adding more columns
and setting the width of those columns, but I wonder if it is possible to set
those properties.

My webservice function is as follows for one column:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections.Generic

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<System.Web.Script.Services.ScriptService()> _
Public Class autocomplete
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function GetSuggestionsFromDataset(ByVal prefixText As String,
ByVal count As Integer) As String()
' Define data set
Dim ds As New DataSet()
Dim dt As New DataTable()
Dim dr As SqlDataReader = PurchasingBLL.GetCostCenters
Dim da As New PurchasingTableAdapters.tbl_CostCenterTableAdapter
ds.Tables.Add(dt)

dt.Columns.Add(New DataColumn("Word", GetType(String)))

dt.Rows.Add("Cost Center")
Do While dr.Read
dt.Rows.Add(New ListItem(dr("FullCCNum")))
Loop


Dim suggestions As New List(Of String)()

Dim words As DataRow() = dt.[Select]("Word LIKE '" + prefixText +
"%'")

Dim num As Integer = IIf((words.Length < count), words.Length, count)
For i As Integer = 0 To num - 1
suggestions.Add(DirectCast(words(i)("Word"), String))
Next
Return suggestions.ToArray()
End Function

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top