calling cs method from javascript

  • Thread starter Thread starter Benny
  • Start date Start date
B

Benny

hello all,

currently im working on an asp.net web application using c#.

im able to calling a javascript funtion in the .aspx page from the
.aspx.cs page method. however, now i want other way round. how can i
call a .aspx.cs method from a javascript funtion in the .aspx page?

thanks,

benny
 
Hi,

You can’t call directly method on the web page from client side
javascript. You can use the postback mechanism to call the page and
activate certain function ( you need to embed client side script that
call __Postback with predefined __EventTarget. on the server side check
__EventTarget form field and if it match your predefined function call
the desire function).

If all of your clients are using IE you can use xmlhttprequest or
webservice.htc to call webservice function on the server side.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
Back
Top