Using Ajax AutoCompleteExtender

An Example of using Ajax


'------Code in AutoExtenderEx.aspx:-------------
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<asp:TextBox ID="TextBox1" runat="server" autocomplete="off"></asp:TextBox>
<cc1:autocompleteextender
runat="server"
ID="AutoCompleteExtender1"
ServicePath="Service.asmx"
ServiceMethod="GetAppNos"
MinimumPrefixLength="1"
TargetControlID="TextBox1">

</cc1:autocompleteextender>

Properites of autocompleteextender:
(1)ServicePath : This the the path of Web service the AutoCompleteExtender will
access.
(2)ServiceMethod : This is the method present in specified WebService.This
method will be called whenever the text changes in the TextBox1(Target
Control)
(3)MinimumPrefixLength : This is the minimun number of characters required to type in TextBox1(Target Control)
(4) TargetControlId : Id of the target control

'----The below is the method in Webservice()------------
_
_
Public Function GetAppNos(ByVal prefixText As String, ByVal count As Integer) As String()
Dim cnn As OracleConnection = New OracleConnection(ReplaceWithurconnstring)
Dim adp As OracleDataAdapter
adp = New OracleDataAdapter("select * from Application where APP_NO like '" + prefixText + "%'", cnn)
Dim daset As Data.DataSet = New Data.DataSet
adp.Fill(daset, "aaa12")
Dim temp As New List(Of String)
For i As Integer = 0 To daset.Tables(0).Rows.Count - 1
temp.Add(daset.Tables(0).Rows(i).Item(0).ToString())
Next
Return temp.ToArray
End Function


Comments

Author: vanchinathan29 May 2010 Member Level: Silver   Points : 1

hi archana,

pls let me know how to use two autocomplete extender for two textboxes using webservice in asp.net with C#.

Thanks in advance.

Author: Surya Gahlot22 Jun 2010 Member Level: Silver   Points : 1

Hi Vanchinathan,

you can get refer detailed article with code in my blog..

http://mscoder.wordpress.com/2010/03/14/dynamically-set-the-autocompleteextender-contextkey/

Surya Gahlot
http://mscoder.wordpress.com



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: