Register  |  Login

 Blog List
Minimize
 RSS
Minimize
You must be logged in and have permission to create or edit a blog.
 View Blog
Minimize
Oct 6

Written by: Usman Shabbir
10/6/2010 4:45 PM 

Step 1: Drop a Script Manager in Page and set its EnablePageMethods property to True.

Step 2: Create a function on the server side that needs to be called from Client Side and add the attribute [WebMethod] on top of it.
[System.Web.Services.WebMethod]
public static void SaveInfo(string Id)
{
// Do server side coding……

}
Setp 3: In the Client Side function just call it like.


function makeFavorite(id) {
PageMethods.SaveInfo(id, CallSuccess, CallFailed);
}

// This will be Called on success
function CallSuccess(res, id) {
alert(destCtrl);
}

// This will be Called on failure
function CallFailed(res) {
alert(res.get_message());
}

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel