Using the Region ASP.NET webControl.

Release 1.0 - ...

The Region webControl is used for rendering SXML directly from ASP.NET pages.

HTML CopyCode image Copy Code
<cms:region runat="server">
   <se:xlinks />
</cms:region>

When building "dual" rendertemplates (shared between Smartsite pages and ASP.NET applications), the region macro can be used to emit ASP.NET code like shown above when appropriate (when the page is requested by the Smartsite Virtual Path Provider (VPP)):

Smartsite SXML CopyCode image Copy Code
<se:region runmode="auto">
   <se:xlinks />
</se:region>

State keeping

You have to keep in mind that cms:region SXML code will be injected into the Smartsite Publication Server at ASP.NET page runtime.

The first cms:region rendering in your ASP.NET page will create a Smartsite RenderEngine, load a Cms Item set up a Rendering Context.

Buffers

This Render Context will be re-used on next renderings from other cms:region tags. This means that page-scope buffers can now be shared across regions in ASP.NET.

Example:

Smartsite SXML CopyCode image Copy Code
<se:region runmode="auto">
   {buffer.set(a, page, 1)}
</se:region>
 
<se:region runmode="auto">
   {buffer.get(a, page, default='Not set')}
</se:region>

This code will work regardless of the rendering environment, which makes building dual templates much easier.

Notes

Each cms:region tag creates its own rendering SXML stack that is fully independent of the initial rendering of the Smartsite page that emitted the cms:region tags using region macros with runmode="auto", so trying to interact with any scoped SXML objects such as placeholders is impossible if these are declared outside the region.

Request State

Request state will be passed to the RenderEngine's Request object, so any items stored in ASP.NET's HttpContext.Items will be available to Smartsite.