469,945 Members | 2,353 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

Trouble using AutoCompleteExtender

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<NamenameCollection = Name.GetNames(prefixText, count);
List<stringnames = 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?
Nov 21 '08 #1
2 4829


"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:ec**************@TK2MSFTNGP05.phx.gbl...
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<NamenameCollection = Name.GetNames(prefixText, count);
List<stringnames = 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?

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

Nov 21 '08 #2
thanks that solved the problem
Nov 21 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Bill | last post: by
1 post views Thread by Steve Allgood | last post: by
2 posts views Thread by Matthias Kaeppler | last post: by
6 posts views Thread by Gary Morris | last post: by
9 posts views Thread by Nathan Sokalski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.