468,116 Members | 2,168 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

trouble calling a webmethod

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<stringGetCompletionList(string prefix, int count)
{
List<stringcars = Car.GetCarsCollection(prefix, count);
List<stringnames = null;
foreach (Car car in cars)
{
names.Add(car.Url);
}
return names;
}

any suggestions why my code isn't executed
Nov 20 '08 #1
5 3879
The WebMethod must be declared as static...

George.

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eo**************@TK2MSFTNGP06.phx.gbl...
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<stringGetCompletionList(string prefix, int count)
{
List<stringcars = Car.GetCarsCollection(prefix, count);
List<stringnames = null;
foreach (Car car in cars)
{
names.Add(car.Url);
}
return names;
}

any suggestions why my code isn't executed
Nov 20 '08 #2
you mean like this:

[WebMethod]
public static List<stringGetCompletionList(string prefix, int count)
{
List<stringcars = Car.GetCarsCollection(prefix, count);
List<stringnames = 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" <it************@hotmail.com.NOSPAMwrote in message
news:eo**************@TK2MSFTNGP06.phx.gbl...
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<stringGetCompletionList(string prefix, int count)
{
List<stringcars = Car.GetCarsCollection(prefix, count);
List<stringnames = null;
foreach (Car car in cars)
{
names.Add(car.Url);
}
return names;
}

any suggestions why my code isn't executed

Nov 20 '08 #3
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" <it************@hotmail.com.NOSPAMwrote in message
news:Oe**************@TK2MSFTNGP04.phx.gbl...
you mean like this:

[WebMethod]
public static List<stringGetCompletionList(string prefix, int count)
{
List<stringcars = Car.GetCarsCollection(prefix, count);
List<stringnames = 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" <it************@hotmail.com.NOSPAMwrote in message
news:eo**************@TK2MSFTNGP06.phx.gbl...
>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<stringGetCompletionList(string prefix, int count)
{
List<stringcars = Car.GetCarsCollection(prefix, count);
List<stringnames = null;
foreach (Car car in cars)
{
names.Add(car.Url);
}
return names;
}

any suggestions why my code isn't executed

Nov 20 '08 #4
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?
Nov 20 '08 #5
They have a download C# right next to the video link
Just download the code

George.

"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:ew*************@TK2MSFTNGP06.phx.gbl...
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?
Nov 21 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Rob Kellow | last post: by
reply views Thread by Kent | last post: by
reply views Thread by Paul Hadfield | last post: by
1 post views Thread by neerom | last post: by
6 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.