JavaScript and C#

G

Greg

Using C# I have a web application where an ASP ImageButton is calling
javascript function. How can I make the javascript function all a procedure
located in my C# code behind form. In other words, I don't want to call
another javascript function, I want to call a C# function located in my code
behind form.

Thx
 
M

Mr. Arnold

Greg said:
Using C# I have a web application where an ASP ImageButton is calling
javascript function. How can I make the javascript function all a
procedure
located in my C# code behind form. In other words, I don't want to call
another javascript function, I want to call a C# function located in my
code
behind form.

You may want to look at Ajax which uses the Code Behind file as a proxy from
the client side. There should be lots of articles about Ajax out on Google
or Dogpile.com

<http://weblogs.asp.net/sohailsayed/...emethods-from-client-side-using-ajax-net.aspx>
 
A

Arne Vajhøj

Greg said:
Using C# I have a web application where an ASP ImageButton is calling
javascript function. How can I make the javascript function all a procedure
located in my C# code behind form. In other words, I don't want to call
another javascript function, I want to call a C# function located in my code
behind form.

The flow in an ASP.NET page is that:
- the C# code runs server side and output HTML & JavaScript
- the HTML & JavaScript is send out to the browser
- the JavaScript runs client side

The JavaScript code running client side can not call the
C# code running server side.

The JavaScript code can send a HTTP request to the server
that executes some C# code.

Good AJAX toolkits can make it almost completely
transparent.

Arne
 

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