当前位置: 首页>>代码示例>>C#>>正文


C# Page.ResolveUrl方法代码示例

本文整理汇总了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"));
 }
开发者ID:jsheely,项目名称:DNN-Module-Template,代码行数:7,代码来源:Utils.cs

示例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>");
 }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:7,代码来源:ExtScriptManager.cs

示例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>");
 }
开发者ID:saiesh86,项目名称:TravelBlog,代码行数:7,代码来源:ExtScriptManager.cs

示例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);
        }
开发者ID:0anion0,项目名称:IBN,代码行数:30,代码来源:PageTemplateNew.ascx.cs

示例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 );
        }
开发者ID:jkilgore,项目名称:Rock-ChMS,代码行数:26,代码来源:GridHyperlinkColumn.cs

示例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));
        }
开发者ID:inspira,项目名称:Web.Generics,代码行数:16,代码来源:HtmlHelperExtensions.cs

示例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;
        }
开发者ID:Blacksmither,项目名称:mixerp,代码行数:34,代码来源:MenuHelper.cs

示例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" ) );
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:8,代码来源:ScriptsManager.cs

示例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" ) );
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:16,代码来源:ScriptsManager.cs

示例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" ) );
     }
 }
开发者ID:dmziryanov,项目名称:ApecAuto,代码行数:8,代码来源:ScriptsManager.cs

示例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
                ));
        }
开发者ID:0anion0,项目名称:IBN,代码行数:20,代码来源:RssGenerator.cs

示例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);
        }
开发者ID:0anion0,项目名称:IBN,代码行数:17,代码来源:UtilHelper.cs

示例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);
        }
开发者ID:0anion0,项目名称:IBN,代码行数:21,代码来源:UtilHelper.cs

示例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();
        }
开发者ID:TaylorLi,项目名称:WorkStudioEnhance,代码行数:38,代码来源:HtmlHelper.cs

示例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();
 }
开发者ID:gettogether,项目名称:common-object,代码行数:42,代码来源:HtmlHelper.cs


注:本文中的System.Web.UI.Page.ResolveUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。