Resources » Code Snippets » AJAX

Using Ajax AutoCompleteExtender


Posted Date: 09-May-2008  Last Updated:   Category: AJAX    
Author: Member Level: Gold    Points: 10



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


Did you like this resource? Share it with your friends and show your love!

Responses to "Using Ajax AutoCompleteExtender"
Author: vanchinathan    29 May 2010Member 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 Gahlot    22 Jun 2010Member 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



Feedbacks      

Post Comment:




  • 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:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Subscribe to Subscribers
    Active Members
    Today
      Last 7 Daysmore...

      Awards & Gifts
      Talk to Webmaster Tony John
      Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India