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 (2)
laminate flooring 01-Sep-2010 06:41:35 
Laminate flooring is an inexpensive type of flooring that offers the consumer many benefits and is relatively easy to install.
Before getting started here is a pro and a con of laminate flooring. Laminate flooring gives your floor that overall look of wood that can be enjoyed for years to come.
laminate flooring 01-Sep-2010 06:41:34 
Laminate flooring is an inexpensive type of flooring that offers the consumer many benefits and is relatively easy to install.
Before getting started here is a pro and a con of laminate flooring. Laminate flooring gives your floor that overall look of wood that can be enjoyed for years to come.
Leave a Reply
Name (Required)  
Mail (will not be published) (required)    
Website
 
Invalid Domain! (http://loveletters.oh-indian.com/blogs/20070927/38/asp-net-autocomplete-feature-using-vbnet.aspx) You are not allowed member of our Sites for link exchange!