本文整理汇总了C#中System.Web.UI.Page.Engine方法的典型用法代码示例。如果您正苦于以下问题:C# Page.Engine方法的具体用法?C# Page.Engine怎么用?C# Page.Engine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.Page
的用法示例。
在下文中一共展示了Page.Engine方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JavaScript
/// <summary>Registers a script block on a page.</summary>
/// <param name="page">The page onto which to added the script.</param>
/// <param name="script">The script to add.</param>
/// <param name="position">Where to add the script.</param>
/// <param name="options">Script registration options.</param>
public static void JavaScript(Page page, string script, ScriptPosition position, ScriptOptions options)
{
if (page == null) throw new ArgumentNullException("page");
if (position == ScriptPosition.Header)
{
JavaScript(page, script, options);
}
else if (position == ScriptPosition.Bottom)
{
string key = script.GetHashCode().ToString();
if (Is(options, ScriptOptions.None))
page.ClientScript.RegisterClientScriptBlock(typeof (Register), key, script);
else if (Is(options, ScriptOptions.ScriptTags))
page.ClientScript.RegisterClientScriptBlock(typeof (Register), key, script, true);
else if (Is(options, ScriptOptions.DocumentReady))
{
JQuery(page);
page.ClientScript.RegisterClientScriptBlock(typeof (Register), key, EmbedDocumentReady(script), true);
}
else if (Is(options, ScriptOptions.Include))
page.ClientScript.RegisterClientScriptInclude(key, page.Engine().ManagementPaths.ResolveResourceUrl(script));
else
throw new ArgumentException("options");
}
else
throw new ArgumentException("position");
}
示例2: AddScriptInclude
private static Control AddScriptInclude(Page page, string resourceUrl, Control holder, bool priority)
{
if (page == null) throw new ArgumentNullException("page");
HtmlGenericControl script = new HtmlGenericControl("script");
page.Items[resourceUrl] = script;
resourceUrl = page.Engine().ManagementPaths.ResolveResourceUrl(resourceUrl);
script.Attributes["src"] = resourceUrl;
script.Attributes["type"] = "text/javascript";
if(priority)
holder.Controls.AddAt(0, script);
else
holder.Controls.Add(script);
return script;
}
示例3: TinyMCE
public static void TinyMCE(Page page)
{
JavaScript(page, page.Engine().ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Resources/tiny_mce/tiny_mce.js"));
}
示例4: TabPanel
public static void TabPanel(Page page, string selector, bool registerTabCss)
{
var key = "N2.Resources.TabPanel" + selector;
if (page.Items[key] == null)
{
JQuery(page);
JQueryPlugins(page);
string script = string.Format(tabPanelFormat, selector, selector.Replace('.', '_'));
JavaScript(page, script, ScriptOptions.DocumentReady);
page.Items[key] = new object();
if (registerTabCss)
{
StyleSheet(page, page.Engine().ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Resources/Css/TabPanel.css"));
}
}
}
示例5: StyleSheet
/// <summary>Register a style sheet reference in the page's header with media type.</summary>
/// <param name="page">The page onto which to register the style sheet.</param>
/// <param name="resourceUrl">The url to the style sheet to register.</param>
/// <param name="media">The media type to assign, e.g. print.</param>
public static void StyleSheet(Page page, string resourceUrl, Media media)
{
if (page == null) throw new ArgumentNullException("page");
if (resourceUrl == null) throw new ArgumentNullException("resourceUrl");
resourceUrl = N2.Web.Url.ToAbsolute(resourceUrl);
if (page.Items[resourceUrl] == null)
{
PlaceHolder holder = GetPlaceHolder(page);
HtmlLink link = new HtmlLink();
link.Href = page.Engine().ManagementPaths.ResolveResourceUrl(resourceUrl);
link.Attributes["type"] = "text/css";
link.Attributes["media"] = media.ToString().ToLower();
link.Attributes["rel"] = "stylesheet";
holder.Controls.Add(link);
page.Items[resourceUrl] = null;
}
}
示例6: JQueryPlugins
public static void JQueryPlugins(Page page)
{
JQuery(page);
JavaScript(page, page.Engine().ManagementPaths.ResolveResourceUrl("{ManagementUrl}/Resources/Js/plugins.ashx?v=" + typeof(Register).Assembly.GetName().Version));
}