Files
mono/mcs/class/System.Web.Extensions/Test/AUT/Sys.Net.PageMethod/PageMethod.js
T
Igor Zelmanovich d3e9c92cd8 fixed test suite
svn path=/trunk/mcs/; revision=82977
2007-07-30 12:03:59 +00:00

57 lines
1.3 KiB
JavaScript

// PageMethods.js
var displayElement;
var valueElement;
// Initializes global variables and session state.
function pageLoad()
{
displayElement = $get("ResultId");
valueElement = $get("ValueId");
PageMethods.SetSessionValue("SessionValue", Date(),
OnSucceeded, OnFailed);
}
// Gets the session state value.
function GetSessionValue(key)
{
PageMethods.GetSessionValue(key,
OnSucceeded, OnFailed);
}
//Sets the session state value.
function SetSessionValue(key, value)
{
PageMethods.SetSessionValue(key, value,
OnSucceeded, OnFailed);
}
// Callback function invoked on successful
// completion of the page method.
function OnSucceeded(result, userContext, methodName)
{
if (methodName == "GetSessionValue")
{
displayElement.innerHTML = "Current session state value: " +
result;
}
else
{
valueElement.innerHTML = "Session state value was sent: "+result;
}
}
// Callback function invoked on failure
// of the page method.
function OnFailed(error, userContext, methodName)
{
if(error !== null)
{
displayElement.innerHTML = "An error occurred: " +
error.get_message();
}
}
if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();