本文整理汇总了C#中System.Web.UI.Page.ResolveUrl方法的典型用法代码示例。如果您正苦于以下问题:C# Page.ResolveUrl方法的具体用法?C# Page.ResolveUrl怎么用?C# Page.ResolveUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.Page
的用法示例。
在下文中一共展示了Page.ResolveUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddFiles
private static void AddFiles(Page page, string controlName, string rootPath, string appRoot)
{
Directory.GetFiles(String.Concat(rootPath, controlName), "*.js", SearchOption.AllDirectories)
.Reverse()
.ToList()
.ForEach(x => ClientResourceManager.RegisterScript(page, page.ResolveUrl(x.Replace(appRoot, "")), 400, "DnnFormBottomProvider"));
}
示例2: IncludeBase
public static void IncludeBase(Page currentPage, string extJsBasePath)
{
currentPage.ClientScript.RegisterClientScriptBlock(
typeof(ExtScriptManager),
"ext-base", "\n<script type=\"text/javascript\" src=\""
+ currentPage.ResolveUrl(extJsBasePath + "adapter/ext/ext-base.js") + "\" ></script>");
}
示例3: IncludeTableGrid
public static void IncludeTableGrid(Page currentPage, string extJsBasePath)
{
currentPage.ClientScript.RegisterClientScriptBlock(
typeof(ExtScriptManager),
"ext-tablegrid", "\n<script type=\"text/javascript\" src=\""
+ currentPage.ResolveUrl(extJsBasePath + "ext-mojo/TableGrid.js") + "\" ></script>");
}
示例4: RegisterLocationScript
public static void RegisterLocationScript(Page page, string title)
{
string pageUrl = page.ResolveUrl("~/Apps/Shell/Pages/default.aspx");
StringBuilder builder = new StringBuilder();
builder.AppendLine(" //<![CDATA[");
builder.AppendLine(" if (parent == window) {");
builder.AppendLine(" if (location.replace)");
builder.AppendLine(" location.replace('" + pageUrl + "#right=' + escapeWithAmp(location.href));");
builder.AppendLine(" else");
builder.AppendLine(" location.href = '" + pageUrl + "#right=' + escapeWithAmp(location.href);");
builder.AppendLine(" }");
builder.AppendLine(" else {");
builder.AppendLine(" if (parent && parent.document) {");
builder.AppendLine(" var td = parent.document.getElementById(\"onetidPageTitle\");");
builder.AppendLine(" if (td)");
builder.AppendLine(" td.innerHTML = self.document.title;");
builder.AppendLine(" }");
builder.AppendLine(" top.document.title = self.document.title + '" + title + "';");
builder.AppendLine(" }");
builder.AppendLine(" function escapeWithAmp(str) {");
builder.AppendLine(" var re = /&/gi;");
builder.AppendLine(" var ampEncoded = \"%26\";");
builder.AppendLine(" return escape(str).replace(re, ampEncoded);");
builder.AppendLine(" }");
builder.AppendLine(" //]]>");
UtilHelper.RegisterScriptBlock(page, builder.ToString(), true);
}
示例5: AddScriptFunctions
internal override void AddScriptFunctions( Page page )
{
ClientScriptManager cs = page.ClientScript;
Type baseType = base.GetType();
string dataFormatString = DataFormatString == string.Empty ? "{0}" : DataFormatString;
string dataNavigateUrlFormatString = page.ResolveUrl( DataNavigateUrlFormatString == string.Empty ? "{0}" : DataNavigateUrlFormatString );
if ( !cs.IsClientScriptBlockRegistered( baseType, "HyperlinkCellFormatter" ) )
cs.RegisterClientScriptBlock( baseType, "HyperlinkCellFormatter", string.Format( @"
function HyperlinkCellFormatter(row, cell, value, columnDef, dataContext) {{
var formattedValue = '{0}';
formattedValue = formattedValue.replace('{{0}}', value);
var hyperlinkValue = '{1}';
hyperlinkValue = hyperlinkValue.replace('{{0}}', dataContext.{2});
return ""<a href='"" + hyperlinkValue + ""'>"" + formattedValue + ""</a>"";
}}
",
dataFormatString,
dataNavigateUrlFormatString,
DataNavigateUrlField), true );
}
示例6: ConvertRelativeUrlToAbsoluteUrl
public static string ConvertRelativeUrlToAbsoluteUrl(this HtmlHelper html, string relativeUrl)
{
string url = relativeUrl.Replace("~", "");
string host = HttpContext.Current.Request.Url.Host;
if (HttpContext.Current.Request.Url.Port != 80)
host = String.Format("{0}:{1}", host, HttpContext.Current.Request.Url.Port);
Page page = new Page();
if (HttpContext.Current.Request.IsSecureConnection)
return string.Format("https://{0}{1}", host, page.ResolveUrl(url));
else
return string.Format("http://{0}{1}", host, page.ResolveUrl(url));
}
示例7: GetPageMenu
public static string GetPageMenu(Page page)
{
if(page != null)
{
string menu = string.Empty;
Collection<Menu> menuCollection = Core.Menu.GetMenuCollection(page.Request.Url.AbsolutePath, 1);
if(menuCollection.Count > 0)
{
foreach(Menu model in menuCollection)
{
menu += string.Format(Thread.CurrentThread.CurrentCulture, "<div class='menu-panel'><div class='menu-header'>{0}</div><ul>", model.MenuText);
Collection<Menu> childMenus = Core.Menu.GetMenuCollection(model.MenuId, 2);
if(childMenus.Count > 0)
{
foreach(Menu childMenu in childMenus)
{
menu += string.Format(Thread.CurrentThread.CurrentCulture, "<li><a href='{0}' title='{1}'>{1}</a></li>", page.ResolveUrl(childMenu.Url), childMenu.MenuText);
}
}
menu += "</ul></div>";
}
}
menu += "<div style='clear:both;'></div>";
return menu;
}
return null;
}
示例8: RegisterRmsTinyMce
public static void RegisterRmsTinyMce( Page page )
{
if( !page.ClientScript.IsClientScriptIncludeRegistered( "rms_tinymce" ) )
{
page.ClientScript.RegisterClientScriptInclude(
"rms_tinymce", page.ResolveUrl( "~/scripts/tinymce/rms_tinymce.js" ) );
}
}
示例9: RegisterMsoFramework
/*public static void RegisterTinyMce( Page page )
{
if( !page.ClientScript.IsClientScriptIncludeRegistered( "tinymce" ) )
{
page.ClientScript.RegisterClientScriptInclude(
"tinymce", page.ResolveUrl( "~/scripts/tinymce/jscripts/tiny_mce.js" ) );
}
}*/
public static void RegisterMsoFramework( Page page )
{
if( !page.ClientScript.IsClientScriptIncludeRegistered( "mso" ) )
{
page.ClientScript.RegisterClientScriptInclude(
"mso", page.ResolveUrl( "~/scripts/mso.js" ) );
}
}
示例10: RegisterJQuery
public static void RegisterJQuery( Page page )
{
if( !page.ClientScript.IsClientScriptIncludeRegistered( "jquery" ) )
{
page.ClientScript.RegisterClientScriptInclude(
"jquery", page.ResolveUrl( "~/scripts/jquery-1.3.2.min.js" ) );
}
}
示例11: CreateRssLink
/// <summary>
/// Creates the RSS link.
/// </summary>
/// <param name="page">The page.</param>
/// <param name="userId">The user id.</param>
/// <param name="className">Name of the class.</param>
/// <param name="objectId">The object id.</param>
/// <param name="currentView">The current view.</param>
/// <returns></returns>
public static string CreateRssLink(Page page, string className, int? objectId, string currentView)
{
Guid userId = User.GetRssKeyByUserId(Security.CurrentUser.UserID);
return page.ResolveUrl(string.Format("~/modules/rssdocument.aspx?u={0}&cn={1}&id={2}&cv={3}",
userId,
className,
objectId.HasValue?objectId.Value.ToString():string.Empty,
currentView == null ? string.Empty : currentView
));
}
示例12: RegisterCssStyleSheet
public static void RegisterCssStyleSheet(Page page, string link)
{
if (page == null)
throw new ArgumentNullException("page");
if (link == null)
throw new ArgumentNullException("link");
if (page.Header == null)
throw new NullReferenceException("page.Header returned null. Add runat=\"server\" to the <head> element.");
HtmlLink htmlLink = new HtmlLink();
htmlLink.Attributes["type"] = "text/css";
htmlLink.Attributes["rel"] = "stylesheet";
htmlLink.Href = page.ResolveUrl(link);
page.Header.Controls.Add(htmlLink);
}
示例13: RegisterScript
public static void RegisterScript(Page page, string link, bool defer)
{
if (page == null)
throw new ArgumentNullException("page");
if (link == null)
throw new ArgumentNullException("link");
if (page.Header == null)
throw new NullReferenceException("page.Header returned null. Add runat=\"server\" to the <head> element.");
HtmlGenericControl child = new HtmlGenericControl();
child.TagName = "script";
child.Attributes["type"] = "text/javascript";
if (defer)
child.Attributes["defer"] = "defer";
child.Attributes["src"] = page.ResolveUrl(link);
page.Header.Controls.Add(child);
}
示例14: GenMenus
public static string GenMenus(Page p)
{
StringBuilder sb_menus = new StringBuilder();
string absolute_url = p.Request.Url.AbsolutePath;
System.Collections.Generic.List<string> lMenus = new System.Collections.Generic.List<string>();
//lMenus.Add("1,Home.aspx,Home|Home.aspx");
lMenus.Add("1,XML/Index.aspx,XML|XML/Index.aspx,XML/Edit.aspx");
lMenus.Add("1,MSSQL/Index.aspx,MS SQL|MSSQL/Index.aspx,MSSQL/Template.aspx,MSSQL/Edit.aspx");
lMenus.Add("1,Oracle/Index.aspx,Oracle|Oracle/Index.aspx,Oracle/Template.aspx,Oracle/Edit.aspx");
//lMenus.Add("1,MYSQL/Index.aspx,MY SQL|MYSQL/Index.aspx");
//lMenus.Add("1,Access/Index.aspx,Access|Access/Index.aspx");
lMenus.Add("1,Downloads/Index.aspx,Downloads|Downloads/Index.aspx");
//lMenus.Add("1,Admin/Index.aspx,Setting|Admin/Index.aspx");
//lMenus.Add("1,Login.aspx?logout=1,Logout|Login.aspx");
string resolve_url = p.ResolveUrl("~");
foreach (string s in lMenus)
{
string[] menu_info = s.Split('|');
string[] menu_detail = menu_info[0].Split(',');
string[] menu_page_ref = menu_info[1].Split(',');
bool is_find_active_page = false;
foreach (string pr in menu_page_ref)
{
if (absolute_url.ToLower().EndsWith(pr.ToLower()))
{
sb_menus.Append(string.Format(MAIN_MENU_ACTIVE, resolve_url, menu_detail[1], menu_detail[2]));
is_find_active_page = true;
break;
}
}
if (!is_find_active_page)
{
sb_menus.Append(string.Format(MAIN_MENU, resolve_url, menu_detail[1], menu_detail[2]));
}
}
return sb_menus.ToString();
}
示例15: GenMenu
/// <summary>
/// Get Menu Html
/// </summary>
/// <param name="p">Current Page Object</param>
/// <param name="lMenus">List Item Like:"1,Home.aspx,Home|Home.aspx,Setup.aspx"</param>
/// <returns></returns>
public static string GenMenu(Page p, List<string> lMenus)
{
StringBuilder sb_menus = new StringBuilder();
if (lMenus != null && lMenus.Count > 0)
{
string absolute_url = p.Request.Url.AbsolutePath;
string resolve_url = p.ResolveUrl("~");
foreach (string s in lMenus)
{
string[] menu_info = s.Split('|');
if (menu_info != null && menu_info.Length > 1)
{
string[] menu_detail = menu_info[0].Split(',');
string[] menu_page_ref = menu_info[1].Split(',');
bool is_find_active_page = false;
if (menu_detail != null && menu_detail.Length > 2)
{
foreach (string pr in menu_page_ref)
{
if (absolute_url.ToLower().EndsWith(pr.ToLower()))
{
sb_menus.Append(string.Format(MAIN_MENU_ACTIVE, resolve_url, menu_detail[1], menu_detail[2]));
is_find_active_page = true;
break;
}
}
if (!is_find_active_page)
{
sb_menus.Append(string.Format(MAIN_MENU, resolve_url, menu_detail[1], menu_detail[2]));
}
}
}
}
}
return sb_menus.ToString();
}