J
Jokke
Hi,
I try to set up a very simple webservice, to feed an AutoCompleteExtender a
list of locations (postal codes + places). In my test page, the textbox does
not do anything at all (no error either).
I have debugged the webservice, and it returns the dataset just fine.
What am I missing?
VS 2008, Ajax Toolkit for 3.5
TESTPAGE (= content page, the master page contains the ToolkitScriptManager
enclosed in form tags):
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master"
AutoEventWireup="false" CodeFile="TestWebservice.aspx.vb"
Inherits="TestPages_TestWebservice" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="asp" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
Runat="Server">
<asp:TextBox ID="txtTestPostcode" runat="server"/>
<asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="txtTestPostcode"
ServiceMethod="GetPostalCodes"
ServicePath="../WebServices/wsPostalCodes.asmx"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true">
</asp:AutoCompleteExtender>
</asp:Content>
CODE IN "~/Webservices/wsPostalCodes.asmx:
<%@ WebService Language="VB" CodeBehind="~/App_Code/wsPostalCodes.vb"
Class="wsPostalCodes" %>
CODE IN "~/App_Code/wsPostalCodes.vb:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class wsPostalCodes
Inherits System.Web.Services.WebService
Private Function GetListofPlaces() As DataSet
Dim strConn As String =
System.Configuration.ConfigurationManager.ConnectionStrings("InoptecPlusConnectionString").ConnectionString
Dim strSQL As String = "SELECT BelLocation FROM vwPostalCodesBEL"
strSQL = "SELECT PostCode + N' ' + Location AS BelLocation FROM
PostcodesBEL"
Dim objConn As New SqlConnection(strConn)
Dim cmd As New SqlCommand(strSQL, objConn)
objConn.Open()
Dim da As New SqlDataAdapter()
da.SelectCommand = cmd
Dim ds As New DataSet()
da.Fill(ds)
objConn.Close()
'Return the DataSet
Return ds
End Function
<WebMethod()> _
Public Function GetPostalCodes() As DataSet
Return GetListofPlaces()
End Function
End Class
I try to set up a very simple webservice, to feed an AutoCompleteExtender a
list of locations (postal codes + places). In my test page, the textbox does
not do anything at all (no error either).
I have debugged the webservice, and it returns the dataset just fine.
What am I missing?
VS 2008, Ajax Toolkit for 3.5
TESTPAGE (= content page, the master page contains the ToolkitScriptManager
enclosed in form tags):
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master"
AutoEventWireup="false" CodeFile="TestWebservice.aspx.vb"
Inherits="TestPages_TestWebservice" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="asp" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent"
Runat="Server">
<asp:TextBox ID="txtTestPostcode" runat="server"/>
<asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="txtTestPostcode"
ServiceMethod="GetPostalCodes"
ServicePath="../WebServices/wsPostalCodes.asmx"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true">
</asp:AutoCompleteExtender>
</asp:Content>
CODE IN "~/Webservices/wsPostalCodes.asmx:
<%@ WebService Language="VB" CodeBehind="~/App_Code/wsPostalCodes.vb"
Class="wsPostalCodes" %>
CODE IN "~/App_Code/wsPostalCodes.vb:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class wsPostalCodes
Inherits System.Web.Services.WebService
Private Function GetListofPlaces() As DataSet
Dim strConn As String =
System.Configuration.ConfigurationManager.ConnectionStrings("InoptecPlusConnectionString").ConnectionString
Dim strSQL As String = "SELECT BelLocation FROM vwPostalCodesBEL"
strSQL = "SELECT PostCode + N' ' + Location AS BelLocation FROM
PostcodesBEL"
Dim objConn As New SqlConnection(strConn)
Dim cmd As New SqlCommand(strSQL, objConn)
objConn.Open()
Dim da As New SqlDataAdapter()
da.SelectCommand = cmd
Dim ds As New DataSet()
da.Fill(ds)
objConn.Close()
'Return the DataSet
Return ds
End Function
<WebMethod()> _
Public Function GetPostalCodes() As DataSet
Return GetListofPlaces()
End Function
End Class