Home All Groups Group Topic Archive Search About

How do I run a server side method from javascript?!

Author
22 Dec 2005 4:46 PM
Steve Kershaw
I have a problem that I need to be able to run a server side method
(MyMethod()) from a javascript script. For example:

<script language="javascript">

      confirmValue = confirm("Do you wish to save?");
      if(confirmValue)
         run MyMethod() here

</script>

There must be a way to do this, but how?

Thanks in advance for your help.

Steve

Author
22 Dec 2005 4:53 PM
Tod Birdsall, MCSD for .NET
Hi Steve,

If you are using ASP.NET 2.0, you may use the ICallbackEventHandler
interface.

Here is an example:

http://bitarray.co.uk/ben/articles/234.aspx

--
Tod Birdsall, MCSD for .Net
blog: http://tod1d.blogspot.com
Are all your drivers up to date? click for free checkup

Author
23 Dec 2005 2:10 AM
intrader
On Thu, 22 Dec 2005 08:46:14 -0800, Steve Kershaw wrote:

Show quoteHide quote
> I have a problem that I need to be able to run a server side method
> (MyMethod()) from a javascript script. For example:
>
> <script language="javascript">
>
>       confirmValue = confirm("Do you wish to save?");
>       if(confirmValue)
>          run MyMethod() here
>
> </script>
>
> There must be a way to do this, but how?
>
> Thanks in advance for your help.
>
> Steve
There is AJAX as well as ICallbackEventHandler.
For a very complete and elegant AJAX implementation look up AJAX.NET
http://ajax.schwarz-interactive.de/

Bookmark and Share