views:

1704

answers:

3

How to pass parameters to [WebMethod] in Asp.Net(C#) ? Can some one please explain the same with the help of an example?

+3  A: 

After you add the web reference you must create an instance of the class that contains the webmethod, then you pass parameters the exact same way as any other method.

Sergio
can you please explain the same with an example. Would highly appreciate it.
Samiksha
+2  A: 

You can see an example here: http://support.microsoft.com/kb/818364

If the helloWorld example received a string you would invoke it like so: myService.HelloWorld("Example");

Sergio
+1  A: 

See How to Consume a Web Service. Even though it's from the point of view of a WCF service and Service Reference, it largely applies to legacy ASMX web references.

John Saunders