Calling server side function in javascript (ASP.Net 2.0)

G

Guest

Hi,

Does anybody know how to call server side function in javascript?

Suppose I've a method named Test() at code behind of ASP.Net page.

How can I call that method in javascript function ???

Any help is appreciated..

Thanks
Crystal
 
P

Phuff

You have to have the script repost to the page and put a query string
in that triggers the method. Thats the only way I know of, as js is
client side. Alternatively you could have an empty aspx page that the
js calls which runs your code and then redirects back to the page.
Then you could store any variables you want in seession variables...its
up to you.
 
Joined
Feb 4, 2010
Messages
28
Reaction score
0
Try AJAX. I think thats what its all about and will work better than
the other solution you have from Phuff.

KK wrote:
> Hi,
>
> Does anybody know how to call server side function in javascript?
>
> Suppose I've a method named Test() at code behind of ASP.Net page.
>
> How can I call that method in javascript function ???
>
> Any help is appreciated..
>
> Thanks
> Crystal
 
M

Mark Rae

You have to have the script repost to the page and put a query string
in that triggers the method. Thats the only way I know of, as js is
client side. Alternatively you could have an empty aspx page that the
js calls which runs your code and then redirects back to the page.
Then you could store any variables you want in seession variables...its
up to you.

Don't even attempt this - use Ajax, that's what it's for.
 
Joined
Feb 7, 2009
Messages
2
Reaction score
0
Hello Every one

visit following for the complete description
dotnetspider.com/resources/25020-Calling-ASP-NET-Server-Side-function-using.aspx

AND

inputoutputinfo.com/dotnet/cSharp/Web-Development/ASP.NET/Web-Services/Web-Methods/Calling-Web-Methods-from-JavaScript/Web-Methods-Page-Methods.html

also for more info

inputoutputinfo.com

thanx
 
Joined
Feb 7, 2009
Messages
2
Reaction score
0
Server Side function using javascript

i think this is the best solution

aspdotnetcode.source-of-humor.com/Articles/WebMethods/Calling-ASPNet-Server-side-function-using-Javascript.aspx

Gud luck
 

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,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top