AutoComplete not filtering with Ajax

M

MarkusJ_NZ

Hi, I have a text box which I have associated with an
AutoCompleteExtender.

e.g.

<cc1:AutoCompleteExtender
runat="server"
ID="autoComplete1"
TargetControlID="TextBox1"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="20"
/>

I then have the following codebehind method which basically just
returns a string array containing countries

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
return AutocompleteHelperClasses.GetCountryList();
}

When I go to my page and enter three characters into the text box I
get the list of all the countries. No filtering is applied when I add
more characters to the text box however. E.g if I enter Belgium I
still see all the countries from Australia through to Zaire

Help appreciated
Thanks
Markus
 
M

MarkusJ_NZ

hello, your problem is the chars separator option... look at this.



MarkusJ_NZ said:
Hi, I have a text box which I have associated with an
AutoCompleteExtender.


I then have the following codebehind method which basically just
returns a string array containing countries
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
return AutocompleteHelperClasses.GetCountryList();
}
When I go to my page and enter three characters into the text box I
get the list of all the countries. No filtering is applied when I add
more characters to the text box however. E.g if I enter Belgium I
still see all the countries from Australia through to Zaire
Help appreciated
Thanks
Markus- Hide quoted text -

- Show quoted text -

Hi, thanks for that but what should I use?
Thanks
Mark
 
S

Steph

MarkusJ_NZ said:
hello, your problem is the chars separator option... look at this.



MarkusJ_NZ said:
Hi, I have a text box which I have associated with an
AutoCompleteExtender.
e.g.
<cc1:AutoCompleteExtender
runat="server"
ID="autoComplete1"
TargetControlID="TextBox1"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="20"
/>
I then have the following codebehind method which basically just
returns a string array containing countries
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
return AutocompleteHelperClasses.GetCountryList();
}
When I go to my page and enter three characters into the text box I
get the list of all the countries. No filtering is applied when I add
more characters to the text box however. E.g if I enter Belgium I
still see all the countries from Australia through to Zaire
Help appreciated
Thanks
Markus- Hide quoted text -
- Show quoted text -

Hi, thanks for that but what should I use?
Thanks
Mark

hi mark, i first time, have you test manually your webservice ?
if all is ok, your control code is not perfect,
you must add :
DelimiterCharacters=";,:"
ServicePath="~/yourdirectoryaspxfile/autocompletion.asmx" (nb : your
webservice must in : App_Code (/AppCode/autocompletion.cs and
autocompletion.asmx contain :
(..)CodeBehind="~/App_Code/autocompletion.cs"(..) )

steph
 
L

Lloyd Sheen

Steph said:
MarkusJ_NZ said:
hello, your problem is the chars separator option... look at this.



MarkusJ_NZ wrote:
Hi, I have a text box which I have associated with an
AutoCompleteExtender.
e.g.
<cc1:AutoCompleteExtender
runat="server"
ID="autoComplete1"
TargetControlID="TextBox1"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="20"
/>
I then have the following codebehind method which basically just
returns a string array containing countries
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
return AutocompleteHelperClasses.GetCountryList();
}
When I go to my page and enter three characters into the text box I
get the list of all the countries. No filtering is applied when I add
more characters to the text box however. E.g if I enter Belgium I
still see all the countries from Australia through to Zaire
Help appreciated
Thanks
Markus- Hide quoted text -
- Show quoted text -

Hi, thanks for that but what should I use?
Thanks
Mark

hi mark, i first time, have you test manually your webservice ?
if all is ok, your control code is not perfect,
you must add :
DelimiterCharacters=";,:"
ServicePath="~/yourdirectoryaspxfile/autocompletion.asmx" (nb : your
webservice must in : App_Code (/AppCode/autocompletion.cs and
autocompletion.asmx contain :
(..)CodeBehind="~/App_Code/autocompletion.cs"(..) )

steph

Just a guess but since you are not passing the characters the user has input
to the AutocompleteHelperClasses.GetCountryList routine you are getting all
the countries. You should be passing prefixText into your subroutine to
allow the subroutine to filter.

LS
 

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