DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   Calling C# function through Javascript in ASP.NET (http://www.daniweb.com/forums/thread31065.html)

SushilKumar Aug 24th, 2005 10:54 am
Calling C# function through Javascript in ASP.NET
 
Hi Guys,

Is it possible to call the C# function from Javasript......

Sushil Kumar :rolleyes:

tgreer Aug 24th, 2005 12:07 pm
Re: Calling C# function through Javascript in ASP.NET
 
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.

serkan sendur Feb 25th, 2008 7:09 am
Re: Calling C# function through Javascript in ASP.NET
 
Quote:

Originally Posted by SushilKumar (Post 155424)
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

SheSaidImaPregy Feb 25th, 2008 6:44 pm
Re: Calling C# function through Javascript in ASP.NET
 
You're a little late serk.. :)

Aug 24th, 2005

farrukhiftikhar Jan 16th, 2009 7:17 am
Re: Calling C# function through Javascript in ASP.NET
 
you can do this.
please visit this article . i thing it would be help full to you.
http://sappidireddy.wordpress.com/20...n-aspnet-ajax/

binbotboo Oct 28th, 2009 1:09 am
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!

carobee Oct 28th, 2009 4:24 am
check out
http://stackoverflow.com/questions/3...rom-javascript

ithelp Oct 28th, 2009 5:34 am
Quote:

Originally Posted by binbotboo (Post 1029287)
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.


All times are GMT -4. The time now is 2:08 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC