I have a textbox that uses an autocomplete extender to get suggestions from a database table. When I run the website from visual studio 2008, the text box autocompletes perfectly, however, after publishing the website and viewing the page from my laptop,
I get no autocomplete suggestions when I type into the text box.
I am viewing the website with IE7.
Has anyone seen this behaviour before and what can I do to get it working on my published website?
IE7vs2008"AJAX .NET 2.0" "Autocomplete Ajax""AJAX Toolkit" "Ajax Control Toolkit"VS 2008"Visual Studio 2008"
From the description its seems that webservice is not returning any data. Is the web service (.asmx) is part of the same website? if the web site is hosted in some other location this will not fetch any data.
Thanks,
Atanu, Symphony Services
P.S. Dont forget to mark this as answer, if you have got resolution to your problem from this post.
We can retrieve the data via web service when we test it from IE. This indicates that we deploy it correctly, including database connection string.
Did you get any error message? We can view logs in Windows Event Viewer.
We can use Visual Studio debugger to attach to the process (such as aspnet_wp) where your application is running to investigate this issue. We can insert Breakpoint in the web service code to make sure this service is been called. For more information about
attaching to process, see
http://msdn.microsoft.com/en-us/library/c6wf8e4z.aspx
I look forward to hearing from you.
Thomas Sun
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
Still no joy finding a solution to this problem ... Could it be an IE7 settings issue or an IIS issue (as it works within the visual studio environment)? Has no-one else seen this problem?
Here's the code (or at least the relevant snippets ...) As I say, it works fine when run from visual studio, but once the website is published it doesn't work ...
WebServiceBinding(ConformsTo =
WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public
class
WebService1 : System.Web.Services.WebService
{
[WebMethod]public
string[] GetSearchTerm(string prefixText,
int count)
{
count = 10;
string sql =
"Select * from tblSearch Where SearchTerm like @prefixText ORDER BY SearchTerm ASC";
SqlDataAdapter da =
new
SqlDataAdapter(sql,
"myconnectionstring");
da.SelectCommand.Parameters.Add("@prefixText",
SqlDbType.VarChar, 50).Value = prefixText +
"%";DataTable dt =
new
DataTable();
da.Fill(dt);
string[] items =
new
string[dt.Rows.Count];
int i = 0;foreach (DataRow
dr in dt.Rows)
kobayashi
Member
1 Points
9 Posts
AJAX AutoComplete works in VS2008 but not on the published website
Aug 20, 2008 03:06 PM|LINK
I have a textbox that uses an autocomplete extender to get suggestions from a database table. When I run the website from visual studio 2008, the text box autocompletes perfectly, however, after publishing the website and viewing the page from my laptop, I get no autocomplete suggestions when I type into the text box.
I am viewing the website with IE7.
Has anyone seen this behaviour before and what can I do to get it working on my published website?
IE7 vs2008 "AJAX .NET 2.0" "Autocomplete Ajax" "AJAX Toolkit" "Ajax Control Toolkit" VS 2008 "Visual Studio 2008"
atanu.podder
Participant
1274 Points
191 Posts
Re: AJAX AutoComplete works in VS2008 but not on the published website
Aug 20, 2008 06:51 PM|LINK
From the description its seems that webservice is not returning any data. Is the web service (.asmx) is part of the same website? if the web site is hosted in some other location this will not fetch any data.
Atanu, Symphony Services
P.S. Dont forget to mark this as answer, if you have got resolution to your problem from this post.
kobayashi
Member
1 Points
9 Posts
Re: AJAX AutoComplete works in VS2008 but not on the published website
Aug 21, 2008 08:08 AM|LINK
The webservice is part of the same website, in fact the website is published on the same machine as the dev environment.
If I access the .asmx from the IE7 browser, I see what i'd expect, a list of supported operations including the getSearchTerm.
Thomas Sun –...
All-Star
64969 Points
5621 Posts
Re: AJAX AutoComplete works in VS2008 but not on the published website
Aug 25, 2008 08:48 AM|LINK
Hi,
We can retrieve the data via web service when we test it from IE. This indicates that we deploy it correctly, including database connection string.
Did you get any error message? We can view logs in Windows Event Viewer.
We can use Visual Studio debugger to attach to the process (such as aspnet_wp) where your application is running to investigate this issue. We can insert Breakpoint in the web service code to make sure this service is been called. For more information about attaching to process, see http://msdn.microsoft.com/en-us/library/c6wf8e4z.aspx
I look forward to hearing from you.
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
kobayashi
Member
1 Points
9 Posts
Re: AJAX AutoComplete works in VS2008 but not on the published website
Aug 28, 2008 02:10 PM|LINK
No error message and nothing in the logs. You can type in the text box, but the autocomplete does not display the suggestions.
kobayashi
Member
1 Points
9 Posts
Re: AJAX AutoComplete works in VS2008 but not on the published website
Sep 15, 2008 03:26 PM|LINK
Still no joy finding a solution to this problem ... Could it be an IE7 settings issue or an IIS issue (as it works within the visual studio environment)? Has no-one else seen this problem?
TCavins
Member
718 Points
213 Posts
Re: AJAX AutoComplete works in VS2008 but not on the published website
Sep 15, 2008 05:20 PM|LINK
I have had no issues using AutoComplete within IE7.
Could you post your relevant code for us to view?
Tim
kobayashi
Member
1 Points
9 Posts
Re: AJAX AutoComplete works in VS2008 but not on the published website
Sep 19, 2008 01:23 PM|LINK
Here's the code (or at least the relevant snippets ...) As I say, it works fine when run from visual studio, but once the website is published it doesn't work ...
=========================================================================================================================================
default.aspx
<%
@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="LiveITResearch._Default" EnableEventValidation="false" ValidateRequest="false"%> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!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" profile="http://www.w3.org/2005/10/profile"> <title>Title</title> </head><
body><
form id="form1" runat="server" defaultbutton="searchsubmit"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="~/WebService1.asmx" /> </Services> </asp:ScriptManager> <asp:LoginView ID="LoginView1" runat="server"> <LoggedInTemplate> <table width="270px" border="0" cellpadding="1" cellspacing="0" style="border-collapse:collapse;"> <tr> <td> <table width="100%" border="0" cellpadding="0"> <tr> <td>Logged in as <asp:LoginName ID="LoginName1" runat="server" /></td> <td><a href="changepassword.aspx">Change Password</a></td> <td><asp:LoginStatus ID="LoginStatus2" runat="server" /></td> </tr> </table> </td> </tr> </table> </LoggedInTemplate> <AnonymousTemplate> <table width="270px" border="0" cellpadding="1" cellspacing="0" style="border-collapse:collapse;"> <tr> <td align="right"> <table width="100%" border="0" cellpadding="0"> <tr> <td width="80%"> </td> <td width="20%" align="right"><asp:LoginStatus ID="LoginStatus2" runat="server" /></td> </tr> </table> </td> </tr> </table> </AnonymousTemplate> </asp:LoginView> </span> <span class="menusearch"><asp:Panel ID="Panel1" runat="server" DefaultButton="searchsubmit"><asp:TextBox ID="searchfield" runat="server" BackColor="#0099CC" BorderColor="#003366" BorderStyle="Solid" BorderWidth="1px" Height="14px" Font-Bold="True" ToolTip="Enter a search term" Font-Size="X-Small" Width="110px"></asp:TextBox> <asp:Button ID="searchsubmit" runat="server" Text="search" BackColor="Black" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" Height="20px" ForeColor="White" PostBackUrl="~/search.aspx" Font-Size="X-Small" /></asp:Panel><cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" DelimiterCharacters="" Enabled="true" ServiceMethod="GetSearchTerm" ServicePath="~/WebService1.asmx" TargetControlID="searchfield" UseContextKey="false" MinimumPrefixLength="1"> </cc1:AutoCompleteExtender></span>More content here ...
</form></
body></
html>==============================================================================================================================================
webservice1.asmx.cs
using
System;using
System.Collections;using
System.Collections.Generic;using
System.ComponentModel;using
System.Data;using
System.Data.SqlClient;using
System.Linq;using
System.Web;using
System.Web.Script.Services;using
System.Web.Services;using
System.Web.Services.Protocols;using
System.Xml.Linq; namespace LiveITResearch{
/// <summary> /// Summary description for WebService1 /// </summary> [WebService(Namespace = "http://www...../")][
WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class WebService1 : System.Web.Services.WebService{
[WebMethod]public string[] GetSearchTerm(string prefixText, int count){
count = 10;
string sql = "Select * from tblSearch Where SearchTerm like @prefixText ORDER BY SearchTerm ASC"; SqlDataAdapter da = new SqlDataAdapter(sql, "myconnectionstring"); da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%";DataTable dt = new DataTable();da.Fill(dt);
string[] items = new string[dt.Rows.Count]; int i = 0;foreach (DataRow dr in dt.Rows){
items.SetValue(dr["SearchTerm"].ToString(), i);i++;
}
return items;}
}
}
===========================================================================================================================================================
Thanks for your help ...