How to call Server Side methods from ClientSide with results back. Earlier we were using Anthem approach but now want to use some thing with AJAX.
Thanks in Advance.
you can use the page methods of the ClientScript control ,
please read : http://aspalliance.com/1294_CodeSnip_Handle_Browser_Close_Event_on_the_ServerSide
Still this has problem on refresh. Is there any other way to do it please?. Need this asap.
Just trying to put the question in details. I have button and onclick of the button I want the server side method to be executed which returns the server time to client. Also should handle callbacks.
This approach was working fine with Anthem but doesn't work with WebUserControl. Thats why want implement AJAX feature.
Thank you for your post!
Why not refer to official document?
Here is it:
http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx, expecially the following section in that page:
Calling Static Methods in an ASP.NET Web Page
You can add static page methods to an ASP.NET page and qualify them as Web methods. You can then call these methods from script as if they were part of a Web service, but without creating a separate .asmx file. To create Web methods in a page, import the System.Web.Services namespace and add a WebMethodAttribute attribute to each static method that you want to expose.
To be able to call static page methods as Web methods, you must set the EnablePageMethods attribute of the ScriptManager control to true.
The following example shows how to call static page methods from the client script to write and read session-state values.For more information about this topic, see
Microsoft Online Community Support