Output
pagemethod.png

ASPX page
<p>
	<asp:Label runat="server" ID="lblChangeMe" Text="not changed" />
</p>
<p>
	<button onclick="ReturnTrue(ShowIt); return false;">Return True</button><br />
	<button onclick="ReturnObject(ShowIt); return false;">Return Object</button><br />
	<button onclick="ReflectInt(3, ShowIt); return false;">Reflect Int</button><br />
	<button onclick="Throw(
		function() { alert('success?'); }, 
		function(err) { alert(err.Message + '\n' + err.StackTrace); }
	); return false;">Throw</button><br />
</p>
<axial:WFServerScript runat="server" />
<axial:WFScript runat="server" MethodName="ShowIt" />


Codebehind
public class Plain
{
	public string Data { get; set; }
}

public partial class PageMethod : System.Web.UI.Page
{
	public void ShowIt(object obj)
	{
		lblChangeMe.Text = obj.ToString();
	}

	[WebMethod]
	public static bool ReturnTrue()
	{
		return true;
	}

	[WebMethod]
	public static Plain ReturnObject()
	{
		return new Plain { Data = "i'm data" };
	}

	[WebMethod]
	public static int ReflectInt(int value)
	{
		return value;
	}

	[WebMethod]
	public static void Throw()
	{
		throw new Exception("here's an exception");
	}
}

Last edited Aug 5, 2008 at 8:29 PM by thasmin, version 2

Comments

No comments yet.