Not directly, no. Server-side functions live server-side, client-side functions live on the client.
In fact, the only way to get ANY server-side code to run, is to submit the form. ASP.NET unrolls the HTTP headers, unpackages the hidden ViewState variable, re-instantiates objects, and then decides what events to raise based on all of the above.
What you can do is have your JavaScript function set a hidden form variable, then do a form.submit().
Then, in your Page_Load handler on the server, use the Request object to check for the presence and/or value of this variable, and call the appropriate server-side method.
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
Hi Guys,
Is it possible to call the C# function from Javasript......
Sushil Kumar :rolleyes:
Yes it is possible to call C# function through javascript using Ajax extensions in Asp.Net
serkan sendur
Postaholic
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
You're a little late serk.. :)
Aug 24th, 2005
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
Just a quick thought here. Vfp programmer learning C#, .net, etc. Even with the time differences on the post I found it really helpfull on my learning curve. Thanks guys!!!
Oct 27, 3009!
Attention Dani ! We have got an alien from future in this board.
ithelp
Nearly a Posting Maven
2,230 posts since May 2006
Reputation Points: 769
Solved Threads: 128