Atlas AutoCompleteExtender not working...

M

Michael Appelmans

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.ConnectionStrings["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();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top