Login failed for user 'cdmslm_country'.
at ApplicationModule.GetDataTable(String SQL, String TableName) in D:\hshome\cdmslm\oh-indian.com\App_Code\ApplicationModule.vb:line 204
at Controls_LeaveAReply.LoadComments() in D:\hshome\cdmslm\oh-indian.com\Controls\LeaveAReply.ascx.vb:line 37 ASP.NET - Auto Complete Feature using VB.NET
Home SWOT Analysis How Strong U R? Articles About Us
Mahatma Gandhi Jawaharlal Nehru Bagat Singh Kamarajar Indira Gandhi

Oh Indian

In remembrance of the Independance day Aug 15, 2007

This site is dedicated to one and all who sincerely participated in freedom struggle. Let us try to fulfill their ambitions!
Skip Navigation Links

ASP.NET - Textbox AutoComplete Feature using VB.NET


The entire internet world is now moving towards the AJAX and related features. In another one or two years there won't be much web sites without the features of AJAX. One of the most respected feature of AJAX Control Extension kit is the Autocompletion feature. But it is not much difficulty to get this result.

We need to use the following procedure:

  1. Make sure you have added the Script Manager from the Ajax into you form.
  2. Put a textbox in it.
  3. From the Ajax Control Extension tools, drag and drop the Autocomplete extender.
  4. Set the TargetControlID of the AutocompleteExtender control like the following.

  5. Right click on the website name and choose the Add Item... option.
  6. Choose the Webservice, give the name Myservice.vb
  7. Go to the Codeview of the MyService and make sure the following code is added. Please note the highlighted lines.
    Imports System.Web
    Imports System.Web.Services
    Imports System.Web.Services.Protocols
    
    <WebService(Namespace:="http://tempuri.org/")> _
    <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    <System.Web.Script.Services.ScriptService()> _
    Public Class MyService
        Inherits System.Web.Services.WebService
    
        <WebMethod()> _
        Public Function HelloWorld() As String
            Return "Hello World"
        End Function
    
        <WebMethod()> _
        Public Function GetRandomList(ByVal prefixText As String, _
                       ByVal count As Int16) As String()
            Dim S(count - 1) As String
    
            Randomize(Now.Ticks)
            Dim I As Integer
            For I = 0 To count - 1
                S(I) = prefixText & CDec(Rnd() * 100000.0#)
            Next
            Return S
        End Function
    
    End Class
  8. Now choose the textbox and enter the properties as shown here.

  9. Run to view the result.
COMMENTS FROM USERS
Leave a Reply
Name (Required)  
Mail (will not be published) (required)    
Website
 
Label