Author: Dovdimus Prime | Posted on: 9/18/2008 5:37:21 AM | Views : 352

Hi all
I'm trying to get a simple page method to work on my page. These are the steps I have taken:
1. Dragged the ScriptManager onto the page.
2. Set the ScriptManager's EnablePageMethods property to true.
3. Created the following codebehind method:[WebMethod]
public static string SayHello()
{
  return "Hello!";
} 4. Registered the following JavaScript onto the page (and checked it appears on the page and references the ClientID of the control 'spnResult' properly):
function writeText()
{
PageMethods.SayHello(OnSucceeded, OnFailed);
}function OnSucceeded
{
document.getElementById('ctl00_ContentPlaceHolder1_spnResult').innerHTML = result;
}
function OnFailed
{
document.getElementById('ctl00_ContentPlaceHolder1_spnResult').innerHTML = 'Something went wrong.' ...

Go to the complete details ...