Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > AutoCompleteExtender doesn't work

Reply
Thread Tools

AutoCompleteExtender doesn't work

 
 
rote
Guest
Posts: n/a
 
      06-01-2007
I tried using the

AutoCompleteExtender sample code below but it doesn't seem to work.
I'm not using a ServicePath="GetCompletionList.asmx"
But the textbox doesn't return anything either does it trigger
Any ideas and thanks in advance

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:TextBox runat="server" ID="myTextBox" Width="300" autocomplete="off" />
<ajaxToolkit:AutoCompleteExtender runat="server"
ID="autoComplete1"
TargetControlID="myTextBox"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="1"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />
</form>



public partial class _Default : System.Web.UI.Page {
[WebMethod]
public static string[] GetCompletionList(string prefixText, int count) {
string sql = String.Format("select companyName from customers where
companyname like @companyname + '%'");

List<string> companyList = new List<string>();
using (SqlConnection connection = new SqlConnection("Integrated
Security=SSPI;Initial Catalog=Northwind;Data Source=."))
using (SqlCommand command = new SqlCommand(sql, connection)) {
connection.Open();
command.Parameters.AddWithValue("@companyname", prefixText);
using (SqlDataReader reader = command.ExecuteReader()) {
while (reader.Read()) {
companyList.Add(reader.GetString(0));
}
}
}

return companyList.ToArray();
}


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX AutocompleteExtender does not work when type between delimeters Shreya Trivedi ASP .Net 0 02-15-2010 07:26 AM
AutoCompleteExtender won't work when receiving list from DB rote ASP .Net 1 11-29-2007 01:56 PM
ASP.NET AJAX AutoCompleteExtender ack95 ASP .Net 0 01-17-2007 03:42 PM
AutoCompleteExtender postback issue Jay ASP .Net 0 07-18-2006 10:05 AM
Atlas AutoCompleteExtender not working... Michael Appelmans ASP .Net 0 06-27-2006 02:22 PM



Advertisments