trouble calling a webmethod

J

Jeff

hi

asp.net 2.0

The webmethod below don't get called. I'm not sure what I do wrong here. I
think it's something to with the parameters. The GetCompletionList takes 2
parameters. I don't set the value of these input parameters.

[WebMethod]
Car: <asp:TextBox ID="txtCar" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1"
runat="server"
TargetControlID="txtCar"
ServicePath="~/Services/AutoCompleteWebSite.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="3" CompletionSetCount="10" >
</cc1:AutoCompleteExtender>


public List<string> GetCompletionList(string prefix, int count)
{
List<string> cars = Car.GetCarsCollection(prefix, count);
List<string> names = null;
foreach (Car car in cars)
{
names.Add(car.Url);
}
return names;
}

any suggestions why my code isn't executed
 
J

Jeff

you mean like this:

[WebMethod]
public static List<string> GetCompletionList(string prefix, int count)
{
List<string> cars = Car.GetCarsCollection(prefix, count);
List<string> names = null;
foreach (Car car in cars)
{
names.Add(car.Url);
}
return names;
}

I've tryed this but the code didn't execute. I wonder if that is because I
haven't specified the values of the input parameters of the
GetCompletionList... not sure how to specify them
 
G

George

I am sorry i did not notice that you using it as a Service and not WebMethod
on page.
Then it does not need to be static.

So you have in your project root file AutoCompleteWebSite.asmx where you
define this GetCompletionList function.

There is a video http://www.asp.net/learn/ajax-videos/video-122.aspx on how
to do it as well as C# code..
Check it out.


George.


Jeff said:
you mean like this:

[WebMethod]
public static List<string> GetCompletionList(string prefix, int count)
{
List<string> cars = Car.GetCarsCollection(prefix, count);
List<string> names = null;
foreach (Car car in cars)
{
names.Add(car.Url);
}
return names;
}

I've tryed this but the code didn't execute. I wonder if that is because I
haven't specified the values of the input parameters of the
GetCompletionList... not sure how to specify them




Jeff said:
hi

asp.net 2.0

The webmethod below don't get called. I'm not sure what I do wrong here.
I think it's something to with the parameters. The GetCompletionList
takes 2 parameters. I don't set the value of these input parameters.

[WebMethod]
Car: <asp:TextBox ID="txtCar" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1"
runat="server"
TargetControlID="txtCar"
ServicePath="~/Services/AutoCompleteWebSite.asmx"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="3" CompletionSetCount="10" >
</cc1:AutoCompleteExtender>


public List<string> GetCompletionList(string prefix, int count)
{
List<string> cars = Car.GetCarsCollection(prefix, count);
List<string> names = null;
foreach (Car car in cars)
{
names.Add(car.Url);
}
return names;
}

any suggestions why my code isn't executed
 
J

Jeff

Yeah I've been watching that video a few times already today. It is that
video I've based my code on. I still don't understand how he pass
paramerters to the GetCompletionList method. That method takes 2 parameters,
but I don't know where they are set.

any ideas how those parameters are specified?
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top