.Net Framework, Asp.net, Ado.net, .Net Remoting, .Net Webservice, SQL, XML, XSLT, WCF, WPF, WWF NHibernate, Ajax, Jquery, DHTML

Ado.netAsp.Net 2.0SQLC-SharpXMLFrameworkIISXMLWebServiceArchitecture
UMLProject ManagementSDLCMethodologiesDesign PatterenOOPWCF.Net RemotingWWF
MVPMVCSilver LightN-HibernateAjaxJ-QuerySEO-MarketingSite MapPhp

Ajaxpro example

Basic AjaxAtlas ImplementationAjax Pro

You can download Ajaxpro from ajaxpro.codeplex.com
Ajax call with WebMethod, get server time
using System.Web.Services;
1:
2:namespace Arindam.AjaxWebMethod
3:{
4: public class WebMethodExample
5: {
6:
7: [System.Web.Services.WebMethod]
8: protected static string GetServerTime()
9: {
10: return DateTime.Now.ToLongTimeString();
11: }
12: }
13:}
14:
Now look how to call the function from javascript
Server side method call from javascript
//Set EnablePageMethods=true in ScriptManager
1:
2:<asp:ScriptManager runat="server" ID="scm3" EnablePageMethods="true" >
3: </asp:ScriptManager>
4:
5:<script language="javascript" type="text/javascript" >
6:
7:function getServerTime()
8:{
9: var time= PageMethods.GetServerTime(onSucced,onFailed);
10: alert (time);
11:}
12:
13:function onSucced(result,UserContext,Methodname)
14:{
15:
16:}
17:function onFailed(result,UserContext,Methodname)
18:{
19:
20:}
21:
22:</script>
23:
Leave your comment.
Name
Email
Comments
Tell Us9671+5 =

Reduce your Dialy IT Cost, Consult with us
Stay healthy in recession

Advertisement
Sponsored by

Privacy Policy ©2009 ETG Consultancy, All Rights Reserved Terms & Conditions
Asp.net, Ado.net, .Net Remoting, .Net Webservice, SQL, XML, XSLT, WCF, WPF, WWF NHibernate, Ajax, Jquery, DHTML