?
Solved

VB AJAX Toolkit Autocomplete extenderwon't work

Posted on 2010-01-11
10
Medium Priority
?
789 Views
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:

Default.aspx:

<%@ 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>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Services>
            <asp:ServiceReference Path="~/WebService.asmx" />
        </Services>
    </asp:ScriptManager>
    <div>
        
    
        <asp:AutoCompleteExtender ID="AutoCompleteExtender1" ServicePath="~/WebService.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" TargetControlID="tbInsert" CompletionInterval="1000" CompletionSetCount="20" runat="server" EnableCaching="true">
        </asp:AutoCompleteExtender>
        <asp:TextBox ID="tbInsert" runat="server" ></asp:TextBox>
    </div>
    </form>
</body>
</html>

WebService.asmx:

<%@ 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)

        con.Open()

        dr = cmd.ExecuteReader()



        Dim items As New List(Of String)

        While (dr.Read())

            items.Add(dr("meserie"))

        End While

        con.Close()

        Return items.ToArray
       

    End Function


End Class

Open in new window

0
Comment
Question by:Softacid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
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?
0
 

Author Comment

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

Author Comment

by:Softacid
ID: 26283514
auto suggest i meant sorry
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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?
0
 

Author Comment

by:Softacid
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
0
 
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
http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33804
0
 

Author Comment

by:Softacid
ID: 26283875
attached an image of the vs.net
untitled.JPG
0
 
LVL 96

Accepted Solution

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


Screenshot.png
0
 

Author Closing Comment

by:Softacid
ID: 31675480
Thank you it worked now ... with the new version
0
 
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.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

765 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