Template in monorail ViewComponent
- by George Polevoy
Is it possible to have a template with html content in vm for a block component?
I'm doing a lot of stuff in html, and want the html reside in a .vm, not in codebehind.
Here is what i've got:
public class TwoColumn : ViewComponent
{
public override void Render()
{
RenderText(@"
<div class='twoColumnLayout'>
<div class='columnOne'>");
// Context.RenderBody();
Context.RenderSection("columnOne");
RenderText(@"
</div>
<div class='columnTwo'>");
Context.RenderSection("columnTwo");
RenderText(@"
</div>
</div>
");
}
}
Here is what i want to get:
pageWithTwoColumns.vm:
#blockcomponent(TwoColumn)
#columnOne
One
#end
#columnTwo
Two
#end
#end
twocolumn/default.vm (pseudocode):
<div class="twoColumnLayout">
<div class="columnOne">
#reference-to-columnOne
</div>
<div class="columnTwo">
#reference-to-columnTwo
</div>
</div>