Check our online training feedbacks Here

29 December 2011

Page Methods in

Now a days, People are looking for richer user experience, In short what they need is more speed or we can say in simple terms, Now a days people dont like waiting.

Ajax is the one by which we can create such applications
In several methods are there for calling Server Side function from JavaScript and Page methods introduced in 2.0 is one of them.

Requirements for creating Page Methods
1.It has to be static
2.It must have attached attribute WebMethod.


Lets Create a small Web application say "CallServerFunction" which contain a web page say "MyDateTimeClass"

using System;
using System.Web.Services;
namespace MarlaLibraries.PageMethods
 public partial class PageMethodTest : System.Web.UI.Page
  public static string GetUniqueId()
   return Guid.NewId.ToString();
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PageMethodTest .aspx.cs" Inherits="MarlaLibraries.PageMethods.Test" %>

. . .
That’s it as you see it’s very easy.Hope you like it. Stay tuned for more.Till then Enjoy Programming..