944,117 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 198124
  • ASP.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
Aug 24th, 2005
0

Calling C# function through Javascript in ASP.NET

Expand Post »
Hi Guys,

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

Sushil Kumar :rolleyes:
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
SushilKumar is offline Offline
1 posts
since Aug 2005
Aug 24th, 2005
0

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.
Team Colleague
Reputation Points: 227
Solved Threads: 37
Made Her Cry
tgreer is offline Offline
1,697 posts
since Dec 2004
Feb 25th, 2008
0

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

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
Featured Poster
Reputation Points: 854
Solved Threads: 127
Banned
serkan sendur is offline Offline
2,057 posts
since Jan 2008
Feb 25th, 2008
0

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

You're a little late serk..

Aug 24th, 2005
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007
Jan 16th, 2009
0

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/
Reputation Points: 10
Solved Threads: 0
Newbie Poster
farrukhiftikhar is offline Offline
1 posts
since Jan 2009
Oct 28th, 2009
0
Re: Calling C# function through Javascript in ASP.NET
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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
binbotboo is offline Offline
1 posts
since Oct 2009
Oct 28th, 2009
0
Re: Calling C# function through Javascript in ASP.NET
Reputation Points: 10
Solved Threads: 12
Posting Whiz in Training
carobee is offline Offline
209 posts
since Dec 2007
Oct 28th, 2009
-1
Re: Calling C# function through Javascript in ASP.NET
Click to Expand / Collapse  Quote originally posted by binbotboo ...
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.
Reputation Points: 769
Solved Threads: 128
Banned
ithelp is offline Offline
1,910 posts
since May 2006
Dec 23rd, 2009
0

Hi

my ID :yasu_6in@yahoo.co.in

without using javascript how to call a server side in function in textbox onblur event

ex:

public void disp()
{
Response.Write("Hi");
}

page_Load()
{
TextBox1.Attributes.Add("onblur","disp()");
}

its not working

how to call this function

without using javascript or any other scripts

similarly i need concept from textbox blur event , not any button events

plz help me to get a code ..

Thanking You
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nimsayunab is offline Offline
1 posts
since Dec 2009
Aug 18th, 2010
0
Re: Calling C# function through Javascript in ASP.NET
Check Out : http://www.dotnetcurry.com/ShowArticle.aspx?ID=109
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Minal Patel is offline Offline
1 posts
since Aug 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Where to store currently selected item?
Next Thread in ASP.NET Forum Timeline: Automated Email





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC