From: Jokke on 26 May 2010 03:03 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
From: Patrice on 26 May 2010 13:08 Hello, AFAIK the service should return a list of strings, not a dataset... Also you may want to double check the location (ServicePath="~/WebServices/wsPostalCodes.asmx" against ServicePath="../WebServices/wsPostalCodes.asmx" deepdning on where exactly is your WebServices folder...) If it still fails I would start with the simplest possible code (for example a regular page and a web service that returns dummy data with the regular ScriptManager). -- Patrice
From: Mr. Arnold on 26 May 2010 17:56 Jokke wrote: > 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 Maybe, you need to be using a listview or grid (show multiple rows), instead of a textbox.
|
Pages: 1 Prev: What's wrong with this file write code Next: AutoCompleteExtender question |