Trouble using AutoCompleteExtender

J

Jeff

hi

VS2008

I have trouble getting the AutoCompleteExtender to work. I've seen the video
at
http://www.asp.net:80/learn/ajax-videos/video-122.aspx but don't understand
what I do wrong. I've even downloaded the source code next to the video and
cannot see what I do wrong here. When I run the .aspx webpage, I start
typing in the textbox but isn't called after I've typed in 3 chars. I know
that method isn't called as I've set a breakpoint in the start of the
GetCompletionList method.

In my datasource there is a name with the pattern "uuu", so if I start
typing "uuu" atleast that name shold be displayed...

*** markup in my .aspx webpage *****************
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/Services/AutoCompleteName.asmx" />
</Services>
</asp:ScriptManager>

Name: <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1"
runat="server"
TargetControlID="txtName"
ServicePath="~/Services/AutoCompleteName.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="3" CompletionSetCount="10" >
</ajaxToolkit:AutoCompleteExtender>

******* ****************

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX,
uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class AutoCompleteName : System.Web.Services.WebService {

public AutoCompleteName () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
List<Name> nameCollection = Name.GetNames(prefixText, count);
List<string> names = null;
foreach (Name name in nameCollection)
{
names.Add(name.surename);
}
return names.ToArray();
}

}

could it be caused by this: ServicePath="~/Services/AutoCompleteName.asmx"
in the video source code it is ServicePath="AutoCompleteName.asmx", but I've
created a subfolder for my .asmx files just in case my project will have
more .asmx files. I thought it was a nice way of keeping the project tidy,
not having everything in the root folder.....

any suggestions?
 
J

Joe Fawcett

Jeff said:
hi

VS2008

I have trouble getting the AutoCompleteExtender to work. I've seen the
video at
http://www.asp.net:80/learn/ajax-videos/video-122.aspx but don't
understand what I do wrong. I've even downloaded the source code next to
the video and cannot see what I do wrong here. When I run the .aspx
webpage, I start typing in the textbox but isn't called after I've typed
in 3 chars. I know that method isn't called as I've set a breakpoint in
the start of the GetCompletionList method.

In my datasource there is a name with the pattern "uuu", so if I start
typing "uuu" atleast that name shold be displayed...

*** markup in my .aspx webpage *****************
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/Services/AutoCompleteName.asmx" />
</Services>
</asp:ScriptManager>

Name: <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1"
runat="server"
TargetControlID="txtName"
ServicePath="~/Services/AutoCompleteName.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="3" CompletionSetCount="10" >
</ajaxToolkit:AutoCompleteExtender>

******* ****************

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX,
uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class AutoCompleteName : System.Web.Services.WebService {

public AutoCompleteName () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
List<Name> nameCollection = Name.GetNames(prefixText, count);
List<string> names = null;
foreach (Name name in nameCollection)
{
names.Add(name.surename);
}
return names.ToArray();
}

}

could it be caused by this: ServicePath="~/Services/AutoCompleteName.asmx"
in the video source code it is ServicePath="AutoCompleteName.asmx", but
I've created a subfolder for my .asmx files just in case my project will
have more .asmx files. I thought it was a nice way of keeping the project
tidy, not having everything in the root folder.....

any suggestions?
Don't you need to uncomment the ScriptService attribute?
 

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