Hi,
I am creating a new page that uses bootstrap and would like to use my existing code (that works with textboxes) to autocomplete from a database connection as the user types. I get the error "Extender control 'CPREmployee_AutoCompleteExtender' cannot extend 'employee_name'. Extender controls of type 'AjaxControlToolkit.AutoCompleteExtender' cannot extend controls of type 'System.Web.UI.HtmlControls.HtmlInputText' " when I attempt to use the same code.
Do I need to change the way I do things when working with Boot strap?
Thank you.
Here is my code:
and the service file:
I am creating a new page that uses bootstrap and would like to use my existing code (that works with textboxes) to autocomplete from a database connection as the user types. I get the error "Extender control 'CPREmployee_AutoCompleteExtender' cannot extend 'employee_name'. Extender controls of type 'AjaxControlToolkit.AutoCompleteExtender' cannot extend controls of type 'System.Web.UI.HtmlControls.HtmlInputText' " when I attempt to use the same code.
Do I need to change the way I do things when working with Boot strap?
Thank you.
Here is my code:
Code:
<input type="text" class="form-control" id="employee_name" size="50" runat="server" placeholder="Begin typing last name...">
<ajaxtoolkit:AutoCompleteExtender
ID="CPREmployee_AutoCompleteExtender"
runat="server"
BehaviorID="AutoCompleteEx"
TargetControlID="employee_name"
ServicePath="TypeAhead.asmx"
ServiceMethod="ComputersTypeAhead"
MinimumPrefixLength="2"
CompletionInterval="10"
EnableCaching="true"
CompletionSetCount="20"
CompletionListCssClass="CompletionListCssClass1"
CompletionListItemCssClass="CompletionListItemCssClass1"
CompletionListHighlightedItemCssClass="CompletionListHighlightedItemCssClass1"
DelimiterCharacters=";, :"
ShowOnlyCurrentWordInCompletionListItem="true">
</ajaxtoolkit:AutoCompleteExtender>Code:
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class TypeAhead
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function ComputersTypeAhead(ByVal prefixText As String) As List(Of String)
Dim con As New System.Data.SqlClient.SqlConnection
con.ConnectionString = ConfigurationManager.ConnectionStrings("VSITConnectionString").ConnectionString
con.Open()
Dim cmd As New System.Data.SqlClient.SqlCommand("Select Last_Name + ', ' + First_Name from Users where Last_Name like @QualName+'%'", con)
cmd.Parameters.AddWithValue("@QualName", prefixText) 'Match user name to what's being typed.
Dim da As New System.Data.SqlClient.SqlDataAdapter(cmd)
Dim dt As New System.Data.DataTable()
da.Fill(dt)
Dim QualNames As New List(Of String)()
For i As Integer = 0 To dt.Rows.Count - 1
QualNames.Add(dt.Rows(i)(0).ToString()) 'Set row i to ZERO due to field placement
Next
Return QualNames
End Function