<<<< Caling sever side function inside Javascript function >>>

i wont to call server side function inside a javascript function

ex:-

.cs file
 

protected void add()

{

//................................ 

 

.aspx file 

 

<script>

function ClientsideAdd()

{

///  I wont to call the sever side function  'add()'  hear

</script> 

 

 

Any one knows how to do this.....

Thank You 

0
chiranchamara
4/30/2008 5:40:36 AM
📁 asp.net.client-side
📃 24353 articles.
⭐ 0 followers.

💬 1 Replies
👁️‍🗨️ 108 Views

You'll probably get a bunch of replies saying "You can't do that, server side scripts run on the server, client side scripts run on the client, and they happen seperately and at seperate times". In general, this is correct. But using ajax, you have options.

Make sure your asp.net website is ajax-enabled (if you don't know how, do some reading up on ajax), and then refer to the following document about webmethods: http://msdn.microsoft.com/en-us/magazine/cc163413.aspx#S4

This stuff allows you to utilise ajax in a simpler way, using the asp.net ajax extensions. It's quite nice, and won't cause a postback to the server. Good luck.

0
bubblesnout
4/30/2008 6:55:15 AM
Reply: