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.
 
T

tamayi

Try AJAX. I think thats what its all about and will work better than
the other solution you have from Phuff.
 
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.
 

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

Top