VB AJAX Toolkit Autocomplete extenderwon't work

Posted on 2010-01-11
Medium Priority
Last Modified: 2012-05-08
Hello i'm beginner in  VB.Net i tried to use the AJAX Toolkit Autocomplete extender with Web service .
The webservice works in browser and return the good results .. the textbox not working ..
Here's the code:


<%@ Page Language="VB" AutoEventWireup="true" CodeFile="default.aspx.vb" Inherits="_Default"  %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
            <asp:ServiceReference Path="~/WebService.asmx" />
        <asp:AutoCompleteExtender ID="AutoCompleteExtender1" ServicePath="~/WebService.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" TargetControlID="tbInsert" CompletionInterval="1000" CompletionSetCount="20" runat="server" EnableCaching="true">
        <asp:TextBox ID="tbInsert" runat="server" ></asp:TextBox>


<%@ WebService Language="VB" Class="autocomplete" %>
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.Data.Common
Imports System.Collections.Generic

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<System.Web.Script.Services.ScriptService()> _
Public Class autocomplete
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function GetCompletionList(ByVal prefixText As String) As String()

        Dim con As SqlConnection

        con = New SqlConnection(ConfigurationManager.ConnectionStrings("mesteriConnectionString").ConnectionString)

        Dim dr As SqlDataReader

        Dim cmd As SqlCommand

        cmd = New SqlCommand("SELECT meserie FROM categorii WHERE meserie Like '" & prefixText & "%' ", con)


        dr = cmd.ExecuteReader()

        Dim items As New List(Of String)

        While (dr.Read())


        End While


        Return items.ToArray

    End Function

End Class

Open in new window

Question by:Softacid
  • 5
  • 5
LVL 96

Expert Comment

by:Bob Learned
ID: 26283477
1) While using the web service is acceptable, you can also use a code-behind method to get the data also.

2) What does "...the textbox not working" mean?

Author Comment

ID: 26283505
Thank you for your interest.
It mean when i start writing didn't pull the results from db .. didn't auto-complete

Author Comment

ID: 26283514
auto suggest i meant sorry
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 96

Expert Comment

by:Bob Learned
ID: 26283738
Are you using 2005 (2.0), or 2008 (3.5)?  What version of the AJAX Control Toolkit are you using?  Do you have the binaries or the source code?

Author Comment

ID: 26283789
I'm using vs. 2008 3.5 and ASPNet AjaxLibraryBeta0911 i installed the panel in the toolbox as in the readme file of the AjaxLibrary
LVL 96

Expert Comment

by:Bob Learned
ID: 26283863
If you are working in a production environment, I would suggest never to use a beta.  

I believe that the current release version is 30930:

AJAX Control Toolkit Release Notes - September 2009 Release

Author Comment

ID: 26283875
attached an image of the vs.net
LVL 96

Accepted Solution

Bob Learned earned 1000 total points
ID: 26283922
Add AutoComplete page method option.


Author Closing Comment

ID: 31675480
Thank you it worked now ... with the new version
LVL 96

Expert Comment

by:Bob Learned
ID: 26284411
With the page method process, you need to have something like this:

    <System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()> _
    Public Shared Function GetCompletionList() As String()
        Return New String() {"John", "Greg", "Jim", "Allen"}
    End Function

There is a bug with the "Add AutoComplete page method" in a VB.NET project.  C# projects work correctly.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Integration Management Part 2
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month9 days, 19 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question