G
Guest
Hi,
I am trying to create an autocomplete textbox from product list. It's not
working.
Here is my WS
<%
@ WebService Language="VB" Class="GetList" %>
Imports
System.Web
Imports
System.Web.Services
Imports
System.Web.Services.Protocols
Imports
System.Data
Imports
System.Data.SqlClient
<WebService(Namespace :=
"http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public
Class GetList
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetProducts(ByVal sName As String) As DataSet
Try
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim ds As New DataSet
conn =
New SqlConnection("Server=Server;Database=Database;User ID=sa;Password=PASS")
cmd =
New SqlCommand("GetProdList", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim param As New SqlParameter()
param.ParameterName =
"@productName"
param.SqlDbType = SqlDbType.VarChar
param.Size = 5
param.Value = sName
cmd.Parameters.Add(param)
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
Return ds
Catch ex As Exception
End Try
End Function
End
Class
The WS is working.
Here is my asp.net app code
<%
@ Page Language="VB" Title="Get List"%>
<!
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">
<style type="text/css">
body { font: 11pt Trebuchet MS;
font-color: #000000;
padding-top: 72px;
text-align: center }
..text { font: 8pt Trebuchet MS }
</style>
</head>
<body>
<form id="Form1" runat="server">
<atlas:ScriptManager id="AtlasPage1" runat="server" />
<div class="page"id="links">
<div id="content">
<h3>AutoComplete server control</h3>
<p>This file contains a server-side Atlas AutoComplete.</p>
<asp:TextBox ID="TextBox1" runat="server">
</asp:TextBox>
<atlas:AutoCompleteExtender runat="server"
ID="autoComplete1">
<atlas:AutoCompleteProperties TargetControlID="TextBox1"
Enabled="True" ServicePath="GetList.asmx"
ServiceMethod="GetProducts"
minimumprefixlength="1" />
</atlas:AutoCompleteExtender>
</div>
</div>
</form>
</body>
</
html>
What am I missing?
I am trying to create an autocomplete textbox from product list. It's not
working.
Here is my WS
<%
@ WebService Language="VB" Class="GetList" %>
Imports
System.Web
Imports
System.Web.Services
Imports
System.Web.Services.Protocols
Imports
System.Data
Imports
System.Data.SqlClient
<WebService(Namespace :=
"http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public
Class GetList
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetProducts(ByVal sName As String) As DataSet
Try
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim ds As New DataSet
conn =
New SqlConnection("Server=Server;Database=Database;User ID=sa;Password=PASS")
cmd =
New SqlCommand("GetProdList", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim param As New SqlParameter()
param.ParameterName =
"@productName"
param.SqlDbType = SqlDbType.VarChar
param.Size = 5
param.Value = sName
cmd.Parameters.Add(param)
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)
Return ds
Catch ex As Exception
End Try
End Function
End
Class
The WS is working.
Here is my asp.net app code
<%
@ Page Language="VB" Title="Get List"%>
<!
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">
<style type="text/css">
body { font: 11pt Trebuchet MS;
font-color: #000000;
padding-top: 72px;
text-align: center }
..text { font: 8pt Trebuchet MS }
</style>
</head>
<body>
<form id="Form1" runat="server">
<atlas:ScriptManager id="AtlasPage1" runat="server" />
<div class="page"id="links">
<div id="content">
<h3>AutoComplete server control</h3>
<p>This file contains a server-side Atlas AutoComplete.</p>
<asp:TextBox ID="TextBox1" runat="server">
</asp:TextBox>
<atlas:AutoCompleteExtender runat="server"
ID="autoComplete1">
<atlas:AutoCompleteProperties TargetControlID="TextBox1"
Enabled="True" ServicePath="GetList.asmx"
ServiceMethod="GetProducts"
minimumprefixlength="1" />
</atlas:AutoCompleteExtender>
</div>
</div>
</form>
</body>
</
html>
What am I missing?