PC Review


Reply
Thread Tools Rate Thread

AutoCompleteExtender doesn't work

 
 
rote
Guest
Posts: n/a
 
      1st Jun 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
Rate This Thread
Rate This Thread:

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 Microsoft ASP .NET 0 15th Feb 2010 07:26 AM
AutoCompleteExtender won't work when receiving list from DB rote Microsoft ASP .NET 1 29th Nov 2007 01:56 PM
Defrag doesn't work because chkdsk doesn't work =?Utf-8?B?bWVnYW4=?= Windows XP Performance 2 3rd Jun 2007 03:21 PM
macro doesn't properly record AutoSum (and SendKeys doesn't work) =?Utf-8?B?Y3JpbXNvbmtuZw==?= Microsoft Excel Programming 2 21st Nov 2006 02:11 PM
Idle-timed Hibernate and/or standby sometimes works and sometimes doesn't, why doesn't it work properly all the time???????? harry Windows XP Performance 0 15th Jan 2004 08:35 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:41 AM.