本文整理汇总了C#中System.Web.Mvc.HtmlHelper.ContentEngine方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlHelper.ContentEngine方法的具体用法?C# HtmlHelper.ContentEngine怎么用?C# HtmlHelper.ContentEngine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.HtmlHelper
的用法示例。
在下文中一共展示了HtmlHelper.ContentEngine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetControlPanelState
/// <summary>Gets the curent state of the control panel.</summary>
/// <param name="html"></param>
/// <returns></returns>
public static ControlPanelState GetControlPanelState(HtmlHelper html)
{
return ControlPanel.GetState(html.ContentEngine().SecurityManager, html.ViewContext.HttpContext.User, html.ViewContext.HttpContext.Request.QueryString);
}
示例2: Plugins
private static string Plugins(HtmlHelper html, ContentItem item, ControlPanelState state)
{
ContentItem start = html.StartPage();
ContentItem root = html.RootPage();
Page p = new Page();
foreach (IControlPanelPlugin plugin in html.ContentEngine().Resolve<IPluginFinder>().GetPlugins<IControlPanelPlugin>())
{
var span = new System.Web.UI.HtmlControls.HtmlGenericControl("span");
span.Attributes["class"] = "control";
var pluginControl = plugin.AddTo(span, new PluginContext(item, null, start, root, state, html.ContentEngine(), html.ViewContext.HttpContext));
if (pluginControl != null)
p.Controls.Add(span);
}
using (var sw = new StringWriter())
using (var htw = new HtmlTextWriter(sw))
{
p.RenderControl(htw);
return sw.ToString();
}
}