what is the PageMethod in .net 2.0 ?

 Posted by Rajkatie on 3/2/2012 | Category: ASP.NET Interview questions | Views: 2674 | Points: 40

It is special type of web service that enables you to create method in page and expose it as a REST resource. It only work with page, not with user control.

Serialization technology used by PageMethod is WCFJSON serializer.

It allows to call server method without creating web service and incurring the overhead of page life-cycle.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Jish on: 3/5/2012 | Points: 10
okk thanku
Posted by: Remyaspai on: 3/16/2012 | Points: 10
An Example Demonstrating Page Methods
To enable Page methods we need to drag a ScriptManager control to the page and need to set
the EnablePageMethods property to “True”.

<asp:ScriptManager ID="ScriptManager1" runat="server"

in code behind add a static method and set it as WebMethod shown below.
[System.Web.Services.WebMethod ]
public static string GetPageMethod()
return "Welcome PageMethods";

In javascript function we can use PageMethods object to call the WebMethod of the page.

function fun()
PageMethods .GetPageMethod(onSucceed, onError);
return false;
function onSucceed(result)
function onError(result)

add a button control and call a client script, which accesses the Webmethods of the page

<asp:Button ID="Button1" runat="server" Text="Call Page Methods"
OnClientClick="return fun()"/>

Login to post response