Usage

Basic Rendering

In order to transform a template, Landscape needs only its name and an xpath document (or something which can be converted into it, like a string or an XmlDocument)

You can supply the renderer with an optional dictionary of parameters which will be passed to the template.

string result = Landscape.Renderer.Render("someTemplate", "<root/>", new Dictionary<string, object>() {
    {"param1", "foo"}, 
    {"param2", "bar"}
});

Render a Widget

string result = Landscape.Renderer.RenderWidget("someWidget", "<root/>", "", new Dictionary<string, object>() {
    {"param1", "foo"}, 
    {"param2", "bar"}
});

Render into an .aspx Page

To integrate Landscape into an ASPX page, you can render directly to an asp.net placeholder.

protected System.Web.UI.WebControls.PlaceHolder phOutput;

protected void Page_Load(object sender, EventArgs e){
	var dataSource = '<root/>';
	var templateParams = new Dictionary<string, object>{
		'param1' => 'foo',
		'param2' => 'bar'
	};
	Landscape.Renderer.RenderToPlaceHolder('some template', dataSource, phOutput, templateParams);
}

Last edited Oct 31, 2011 at 12:03 AM by Kunyo, version 8

Comments

No comments yet.