Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Bhushan BhasmeRank #2,348 · 604 reputationPosted Sep 28, 2016, 4:57 AM EDT
Anil ThakurRank #1,015 · 1.9K reputationPosted Sep 28, 2016, 5:00 AM EDT
Ujjwal GuptaRank #1,687 · 905 reputationPosted Sep 28, 2016, 5:07 AM EDT
Midhun TpRank #388 · 6.5K reputationPosted Sep 28, 2016, 5:45 AM EDT
I think you are using ajax concept for autocomplete. In your ajax page, remove all codes from aspx page. That is doctype, html tag, head tag, etc...
diane moussa22 reputationPosted Sep 28, 2016, 7:28 AM EDT
<asp:TextBox ID="txtdepartementadd" runat="server" class="form-control col-md-6">
</asp:TextBox>
<cc1:AutoCompleteExtender ServiceMethod="SearchDepartement"
MinimumPrefixLength="2"
CompletionInterval="100" EnableCaching="false" CompletionSetCount="10"
TargetControlID="txtdepartementadd"
ID="AutoCompleteExtender1" runat="server" FirstRowSelected ="false">
</cc1:AutoCompleteExtender>
</td>
System.Web.Services.WebMethod()> _
Public Shared Function SearchDepartement(ByVal prefixText As String, ByVal count As Integer) As List(Of String)
Try
Dim conn As SqlConnection = New SqlConnection
conn.ConnectionString = ConfigurationManager _
.ConnectionStrings("ficogesconn").ConnectionString
Dim cmd As SqlCommand = New SqlCommand
cmd.CommandText = "select Libelle from Departement where" & _
" Libelle like @SearchText + '%'"
cmd.Parameters.AddWithValue("@SearchText", prefixText)
cmd.Connection = conn
conn.Open()
Dim departements As List(Of String) = New List(Of String)
Dim sdr As SqlDataReader = cmd.ExecuteReader
While sdr.Read
departements.Add(sdr("Libelle").ToString)
End While
conn.Close()
Return departements
Catch ex As Exception
End Try
End Function
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Sep 28, 2016, 7:28 PM EDT