本文整理汇总了C#中Castle.MonoRail.Framework.Controller.DirectRender方法的典型用法代码示例。如果您正苦于以下问题:C# Controller.DirectRender方法的具体用法?C# Controller.DirectRender怎么用?C# Controller.DirectRender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Castle.MonoRail.Framework.Controller
的用法示例。
在下文中一共展示了Controller.DirectRender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderFromTemplate
protected void RenderFromTemplate(String templateName, Controller controller)
{
StringWriter writer = new StringWriter();
IDictionary context = new Hashtable();
context.Add("flash", controller.Context.Flash);
foreach(DictionaryEntry entry in controller.PropertyBag)
{
context.Add(entry.Key, entry.Value);
}
#if USE_LOCAL_TEMPLATES
templateEngine.Process( context, templateName, writer );
#else
templateEngine.Process( context, "Castle.MonoRail.ActiveRecordScaffold/Templates/" + templateName, writer );
#endif
if (useDefaultLayout)
{
StringWriter layoutwriter = new StringWriter();
context.Add("childContent", writer.GetStringBuilder().ToString());
#if USE_LOCAL_TEMPLATES
templateEngine.Process(context, "layout.vm", layoutwriter);
#else
templateEngine.Process(context, "Castle.MonoRail.ActiveRecordScaffold/Templates/layout.vm", layoutwriter);
#endif
writer = layoutwriter;
controller.CancelView();
controller.Response.Write(writer.GetStringBuilder().ToString());
}
else
{
controller.DirectRender(writer.GetStringBuilder().ToString());
}
}