473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Atlas AutoCompleteExtender not working...



I have essentially copied the samplelist2.aspx from the Atlas samples but
the autocomplete feature is not working in my page. The web service asmx
works from a browser. Thanks for any suggestions on how to diagnose this.

Here is my aspx code:

<atlas:ScriptManager ID="scriptmanager1" EnablePartialRendering="true"
runat="Server" />
<asp:Panel ID="Panel1" runat="server" style="margin-top:10px;padding-left:20px;"
Height="24px" Width="640px">
<atlas:UpdatePanel ID="UpdatePanel1" Mode="Conditional" runat="server">
<ContentTemplate>
<asp:Label ID="ShowLabel" runat="server" CssClass="waLabel">Show:
</asp:Label>
<asp:DropDownList ID="SearchModeDropDownList" runat="server"
AutoPostBack="True" CssClass="waDdl">
<asp:ListItem Selected="True" Value="0">All</asp:ListItem>
<asp:ListItem Value="1">Search</asp:ListItem>
</asp:DropDownList>

<asp:TextBox ID="SearchLocationNameTextBox" runat="server" CssClass="waTextBox"></asp:TextBox>

<asp:Button ID="SearchBtn" CssClass="waButton" Text=" >> "
CommandName="search" CommandArgument="-2" runat="server" />
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel>

<atlas:AutoCompleteExtender ID="AutoCompleteSearch" runat="server">
<atlas:AutoCompleteProperties TargetControlID="SearchLocationNameTextBox"
Enabled="true" ServicePath="VanPoolService.asmx"
ServiceMethod="GetLocationNames" MinimumPrefixLength="1"/>
</atlas:AutoCompleteExtender>

Here is my web service code:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class VanPoolService : System.Web.Services.WebService
{
public VanPoolService()
{
}

[WebMethod]
public string[] GetLocationNames(string prefixText, int count)
{
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrin gs["cobbcc"].ConnectionString);
SqlCommand cmd = new SqlCommand(
"SELECT DISTINCT TOP(@nrows) Name FROM Locations WHERE Name like
@term", cn);
cmd.Parameters.Add("nrows", count);
cmd.Parameters.Add("term", prefixText + "%");
List<string> suggestions = new List<string>();
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) )
{
while (dr.Read())
suggestions.Add(dr[0].ToString());
}
return suggestions.ToArray();
}
}
Jun 27 '06 #1
2 3017
I have essentially copied the samplelist2.aspx from the Atlas samples but
the autocomplete feature is not working in my page. The web service asmx
works from a browser. Thanks for any suggestions on how to diagnose this.

Here is my aspx code:

<atlas:ScriptManager ID="scriptmanager1" EnablePartialRendering="true"
runat="Server" />
<asp:Panel ID="Panel1" runat="server" style="margin-top:10px;padding-left:20px;"
Height="24px" Width="640px">
<atlas:UpdatePanel ID="UpdatePanel1" Mode="Conditional" runat="server">
<ContentTemplate>
<asp:Label ID="ShowLabel" runat="server" CssClass="waLabel">Show:
</asp:Label>
<asp:DropDownList ID="SearchModeDropDownList" runat="server"
AutoPostBack="True" CssClass="waDdl">
<asp:ListItem Selected="True" Value="0">All</asp:ListItem>
<asp:ListItem Value="1">Search</asp:ListItem>
</asp:DropDownList>

<asp:TextBox ID="SearchLocationNameTextBox" runat="server" CssClass="waTextBox"></asp:TextBox>

<asp:Button ID="SearchBtn" CssClass="waButton" Text=" >> "
CommandName="search" CommandArgument="-2" runat="server" />
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel>

<atlas:AutoCompleteExtender ID="AutoCompleteSearch" runat="server">
<atlas:AutoCompleteProperties TargetControlID="SearchLocationNameTextBox"
Enabled="true" ServicePath="VanPoolService.asmx"
ServiceMethod="GetLocationNames" MinimumPrefixLength="1"/>
</atlas:AutoCompleteExtender>

Here is my web service code:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class VanPoolService : System.Web.Services.WebService
{
public VanPoolService()
{
}

[WebMethod]
public string[] GetLocationNames(string prefixText, int count)
{
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrin gs["cobbcc"].ConnectionString);
SqlCommand cmd = new SqlCommand(
"SELECT DISTINCT TOP(@nrows) Name FROM Locations WHERE Name like
@term", cn);
cmd.Parameters.Add("nrows", count);
cmd.Parameters.Add("term", prefixText + "%");
List<string> suggestions = new List<string>();
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) )
{
while (dr.Read())
suggestions.Add(dr[0].ToString());
}
return suggestions.ToArray();
}
}
first of all :

cmd.Parameters.Add("nrows", count);
cmd.Parameters.Add("term", prefixText + "%");

should be (as far as i know) :

cmd.Parameters.Add("@nrows", count);
cmd.Parameters.Add("@term", prefixText + "%");

i'm making this myself a.t.m. and will post back here when it works
Jul 6 '06 #2
[WebMethod]
public string[] GetAllNames(string prefixText, int count)
{
SqlConnection cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\Database.mdf;Integrated Security=True;User Instance=True");
SqlCommand cmd = new SqlCommand("SELECT Naam FROM [Table] WHERE Naam LIKE @term", cn);
cmd.Parameters.AddWithValue("@term", prefixText + "%");
System.Collections.Generic.List<string> suggestions = new System.Collections.Generic.List<string>();
cn.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
dr.Read();
while (dr.Read())
suggestions.Add(dr[0].ToString());
}
return suggestions.ToArray();
}

i've removed the :
cmd.Parameters.Add("@nrows", count); part but you can put that back in.
i've also sticked with the original method name and variables since i heared that you shouldn't change those (sounds like ..*bad word*... to me but i didn't mind keeping the original name)

for questions contact me at kputten(at-sign)multilevel(dot)nl
(at-sign = @ ofcource )
and (dot = . )
Jul 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris | last post by:
Hi, I am trying to create an autocomplete textbox from product list. It's not working. Here is my WS
4
by: Brad Baker | last post by:
I'm trying to implement a gridview control using atlas & asp.net per the following article: http://weblogs.asp.net/scottgu/archive/2005/12/26/433997.aspx My frustration is that the page I've...
11
by: =?Utf-8?B?VHJlbnQ=?= | last post by:
I have tied an AutoCompleteExtender to a textbox to indicate suggestions to the user. Everything works fine if I utilize a webservice to fetch the results. However, I want to put the web service...
0
by: Dunc | last post by:
Has anyone successfully managed to get the Altas Toolbox AutoCompleteExtender working inside a GreyBox control? While I've got the code and code-behind working fine, the "dropdown" panel is...
0
by: askaquest | last post by:
Hello, I am using AutoCompleteExtender.The program Run without any errors.But It doesn't show suggestions bellow the textBox. My aspx page is as follows: <form id="form1" runat="server"> ...
0
by: =?Utf-8?B?RXlhbA==?= | last post by:
I am having problems with AutoCompleteExtender in modal window. For normal window things are working fine but when ever I am opening the same page in a modal window the AutoCompleteExtender feature...
1
by: maz00 | last post by:
Hi guys, I'm running into an issue where my AutoCompleteExtender stops working as soon as I make changes to my global.asax file for URL rewriting. I just want to take a URL...
4
by: giveDsolution | last post by:
Can Anyone Plz help me in using AutoCompleteExtender. I have used this link http://www.infinitezest.com/articles/using-autocompleteextender-with-results-from-database.aspx But its not working
4
by: Peter | last post by:
ASP.NET 2.0 I have an AutoCompleteExtender which works fine- I am using name, id pair in the WebService , but what I am trying to do is: once the user selects an item from the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.