User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 401,685 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,646 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 49700 | Replies: 3
Reply
Join Date: Aug 2005
Posts: 1
Reputation: SushilKumar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
SushilKumar's Avatar
SushilKumar SushilKumar is offline Offline
Newbie Poster

Calling C# function through Javascript in ASP.NET

  #1  
Aug 24th, 2005
Hi Guys,

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

Sushil Kumar :rolleyes:
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Posts: 1,590
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Calling C# function through Javascript in ASP.NET

  #2  
Aug 24th, 2005
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.
Reply With Quote  
Join Date: Jan 2008
Location: istanbul
Posts: 265
Reputation: serkansendur is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 23
serkansendur's Avatar
serkansendur serkansendur is offline Offline
Posting Whiz in Training

Re: Calling C# function through Javascript in ASP.NET

  #3  
Feb 25th, 2008
Originally Posted by SushilKumar View Post
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 Şendur
MCAD.NET
Reply With Quote  
Join Date: Sep 2007
Posts: 1,057
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Calling C# function through Javascript in ASP.NET

  #4  
Feb 25th, 2008
You're a little late serk..

Aug 24th, 2005
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 7:45 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC