• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# HtmlControls.HtmlLink类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlLink的典型用法代码示例。如果您正苦于以下问题:C# HtmlLink类的具体用法?C# HtmlLink怎么用?C# HtmlLink使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HtmlLink类属于System.Web.UI.HtmlControls命名空间,在下文中一共展示了HtmlLink类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PrintWebControl

        public static void PrintWebControl(Control ctrl, string Script)
        {
            StringWriter stringWrite = new StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            if (ctrl is WebControl)
            {
                Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w;
            }
            Page pg = new Page();
            pg.EnableEventValidation = false;
            pg.StyleSheetTheme = "../CSS/order.css";
            if (Script != string.Empty)
            {
                pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script);
            }

            HtmlLink link = new HtmlLink();
            link.Href = "../CSS/order.css";
            HtmlForm frm = new HtmlForm();
            pg.Controls.Add(frm);
            frm.Attributes.Add("runat", "server");
            frm.Controls.Add(ctrl);
            pg.DesignerInitialize();
            pg.RenderControl(htmlWrite);
            string strHTML = stringWrite.ToString();
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write("<head runat='server'> <title>Printer - Bản in tại Support.evnit.evn.com.vn</title> <link type='text/css' rel='stylesheet' href='../CSS/order.css'><link type='text/css' rel='stylesheet' href='../CSS/style.css'></head>");
            HttpContext.Current.Response.Write(strHTML);
            HttpContext.Current.Response.Write("<script>window.print();</script>");
            HttpContext.Current.Response.End();
        }
开发者ID:trungjc,项目名称:quanlyhocsinh,代码行数:31,代码来源:PrintHelper.cs


示例2: CreateChildControls

        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();

            ErrorControl errorControl = new ErrorControl();

            if (this.IsAsyncPostBackRequest)
            {
                Controls.Add(errorControl);
            }
            else
            {
                HtmlGenericControl html = new HtmlGenericControl("html");

                HtmlHead head = new HtmlHead();

                HtmlLink link = new HtmlLink();
                link.Href = HttpRuntime.AppDomainAppVirtualPath + "/UIBase/Styles/GlobalReset.css";
                link.Attributes.Add("rel", "stylesheet");
                link.Attributes.Add("type", "text/css");

                head.Controls.Add(link);
                html.Controls.Add(head);

                Controls.Add(html);

                HtmlGenericControl body = new HtmlGenericControl("body");
                body.Attributes.Add("style", "padding: 10px");
                body.Controls.Add(errorControl);
                html.Controls.Add(body);
            }
        }
开发者ID:rsdgjb,项目名称:GRP_PERFICIENT,代码行数:35,代码来源:ErrorHandler.ashx.cs


示例3: RegisterCssInclude

        public static void RegisterCssInclude(this ClientScriptManager clientScriptManager, string cssUrl, ResourceInsertPosition position)
        {
            if (cssUrl.StartsWith("~"))
                cssUrl = VirtualPathUtility.ToAbsolute(cssUrl);

            Page page = (Page)HttpContext.Current.Handler;
            if (page.Items[cssUrl] == null)
            {
                HtmlLink link = new HtmlLink();
                link.Href = cssUrl;
                link.Attributes["type"] = "text/css";
                link.Attributes["rel"] = "stylesheet";
                link.Attributes["title"] = "Default Style";

                switch (position)
                {
                    case ResourceInsertPosition.HeaderTop:
                        {
                            int index = (int)(page.Items["__CssResourceIndex"] ?? 0);
                            page.Header.Controls.AddAt(index, link);
                            page.Items["__CssResourceIndex"] = ++index;
                        }
                        break;
                    case ResourceInsertPosition.HeaderBottom:
                        page.Header.Controls.Add(link);
                        break;
                    case ResourceInsertPosition.BodyBottom:
                        page.Form.Controls.Add(link);
                        break;
                }

                page.Items[cssUrl] = new object();
            }
        }
开发者ID:dpawatts,项目名称:zeus,代码行数:34,代码来源:ClientScriptManager.cs


示例4: addStyleSheet

        public static void addStyleSheet(string css, string key, Page currentPage, WebControl control)
        {
            ControlCollection ctrls = currentPage.Controls;
            if (currentPage.Master != null)
                ctrls = currentPage.Master.Controls;

            foreach (Control ctrl in ctrls)
            {
                if (ctrl.GetType().Name == "HtmlHead")
                {
                    ctrls = ctrl.Controls;
                    break;
                }
            }

            if (key != null)
            {
                foreach (Control ctrl in ctrls)
                {
                    if (ctrl.ID == key)
                        return;
                }
            }

            string url = currentPage.ClientScript.GetWebResourceUrl(control.GetType(), "ESWCtrls.ResEmbed.Styles." + css);
            HtmlLink link = new HtmlLink();
            link.Attributes.Add("type", "text/css");
            link.Attributes.Add("rel", "stylesheet");
            link.Attributes.Add("media", "screen");
            link.Href = url;
            link.ID = key;

            ctrls.Add(new LiteralControl("\n"));
            ctrls.Add(link);
        }
开发者ID:Leonscape,项目名称:ESWCtrls,代码行数:35,代码来源:Util.cs


示例5: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            String ukeyString = Request.QueryString["ukey"];
            int inukey = ukeyString == null ? -1 : int.Parse(ukeyString);
            ukeyHiddenField.Value = inukey.ToString();
            TwitterLink.Visible = inukey != -1;
            FaceBookLink.Visible = inukey != -1;
            if (inukey == -1)
                inukey = FacesLite.GetRandomUkey(inukey);
            FaceUkeyLabel.Text = "  " + inukey.ToString();
            Image1.ImageUrl = String.Format("https://s3.amazonaws.com/FaceSpace/Faces/{0}.jpg", inukey);
            Image2.ImageUrl = String.Format("https://s3.amazonaws.com/FaceSpace/Faces/{0}.anti.jpg", inukey);
            Image3.ImageUrl = String.Format("https://s3.amazonaws.com/FaceSpace/Faces/{0}.reconstituted.jpg", inukey);
            Image3.Attributes.Add("title", "Synthetic, Reconstructed Face");

            SynthFaceLink.NavigateUrl = String.Format("http://facefield.org/SynthFace.aspx?ukey={0}", inukey);
            SpectrumLink.NavigateUrl = String.Format("http://facefield.org/Carousel.aspx?ukey={0}", inukey);
            TwitterLink.NavigateUrl = String.Format("http://twitter.com/share?text={0}&url={1}",
                HttpUtility.UrlEncode("My anti-face looks just like me. Not.\n#antiface @face_field"),
                Request.Url
                );
            FaceBookLink.NavigateUrl = String.Format("https://www.facebook.com/sharer/sharer.php?u={0}", Request.Url);

            // tell facebook which thumbnail to use.
            HtmlLink canonical = new HtmlLink();
            canonical.Href = String.Format("https://s3.amazonaws.com/FaceSpace/Faces/{0}.thumb.anti.jpg", inukey);
            canonical.Attributes["rel"] = "image_src";
            Page.Header.Controls.Add(canonical);
        }
开发者ID:rwoodley,项目名称:FaceToys,代码行数:29,代码来源:Me.aspx.cs


示例6: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            using (HtmlLink stylesheet = new HtmlLink())
            {
                string path = "/bundles/master-page.css";

                if (CultureManager.IsRtl())
                {
                    path = path.Replace("css", "rtl.css");
                }

                stylesheet.Href = path;
                stylesheet.Attributes["rel"] = "stylesheet";
                stylesheet.Attributes["type"] = "text/css";
                stylesheet.Attributes["media"] = "all";
                this.Page.Header.Controls.Add(stylesheet);
            }

            if (Offices.GetOffices(AppUsers.GetCurrentUserDB()).Any())
            {
                this.Response.Redirect("~/SignIn.aspx");
            }

            this.RegisterJavascript();
        }
开发者ID:abinabrahamanchery,项目名称:mixerp,代码行数:25,代码来源:Default.aspx.cs


示例7: AddLink

 protected void AddLink(Control cssRoot, int InsertAt, HtmlLink link)
 {
     if (string.IsNullOrEmpty(Condition))
     {
         if (InsertAt == -1)
         {
             cssRoot.Controls.Add(link);
         }
         else
         {
             cssRoot.Controls.AddAt(InsertAt, link);
         }
     }
     else
     {
         var openif = new Literal();
         openif.Text = string.Format("<!--[if {0}]>", Condition);
         var closeif = new Literal();
         closeif.Text = "<![endif]-->";
         if (InsertAt == -1)
         {
             cssRoot.Controls.Add(openif);
             cssRoot.Controls.Add(link);
             cssRoot.Controls.Add(closeif);
         }
         else
         {
             //Since we want to add at a specific location, we do this in reverse order
             //this allows us to use the same insertion point
             cssRoot.Controls.AddAt(InsertAt, closeif);
             cssRoot.Controls.AddAt(InsertAt, link);
             cssRoot.Controls.AddAt(InsertAt, openif);
         }
     }
 }
开发者ID:rcedev,项目名称:evans-software-solutions,代码行数:35,代码来源:Styles.ascx.cs


示例8: SetCanonicalUrl

        protected virtual void SetCanonicalUrl(string canonicalUrl)
        {
            if (String.IsNullOrEmpty(canonicalUrl))
            {
                throw new Exception("Empty canonical url");
            }

            canonicalUrl = canonicalUrl.ToLower();

            if (!String.IsNullOrEmpty(canonicalUrl))
            {
                var requestUrl = Request.Url.ToString();

                if (requestUrl != canonicalUrl && requestUrl != canonicalUrl + "default.aspx" /*&& !requestUrl.Contains("localhost")*/)
                {
                    Response.Redirect(canonicalUrl);
                }
            }

            if (!_canonicalUrlAdded)
            {
                var link = new HtmlLink();
                link.Attributes["rel"] = "canonical";
                link.Href = canonicalUrl;

                Header.Controls.Add(link);
                _canonicalUrlAdded = true;
            }
            else
            {
                throw new Exception("Canonical url already added");
            }
        }
开发者ID:jorik041,项目名称:X.Web,代码行数:33,代码来源:XPage.cs


示例9: AddStyleSheet

 public void AddStyleSheet(Page page, string cssPath)
 {
     HtmlLink link = new HtmlLink();
     link.Href = cssPath;
     link.Attributes["rel"] = "stylesheet";
     link.Attributes["type"] = "text/css";
 }
开发者ID:qq358292363,项目名称:showShop,代码行数:7,代码来源:BasePage.cs


示例10: AddToClientScriptManager

 /// <summary>
 /// Adds to client script manager.
 /// </summary>
 /// <param name="page">The page.</param>
 /// <param name="link">The link.</param>
 private static void AddToClientScriptManager(Page page, HtmlLink link)
 {
     HtmlTextWriter writer = new HtmlTextWriter(new StringWriter(new StringBuilder()));
       link.RenderControl(writer);
       page.ClientScript.RegisterClientScriptBlock(typeof(Page),
     writer.InnerWriter.ToString(), writer.InnerWriter.ToString());
 }
开发者ID:Refactored,项目名称:SitecoreCalendarModule,代码行数:12,代码来源:PageExtensions.cs


示例11: DoSEO

        protected void DoSEO()
        {
            HtmlLink canonicalTag = new HtmlLink();
            canonicalTag.Attributes.Add("rel", "canonical");

            // Set page title
            ((DotNetNuke.Framework.CDefault)this.Page).Title = ModuleConfiguration.ModuleTitle;

            if (Request.QueryString["target"] == "ingredient")
            {// Eventual target will be a list of ingredients--show the ingredient div

                // Set page meta description
                ((DotNetNuke.Framework.CDefault)this.Page).Description = "Browse liquors and mixers by alcohol proof.";

                // Set page link canonical tag
                canonicalTag.Href = ConfigurationManager.AppSettings["SiteUrl"] + "ingredients/browse/proof";
            }
            else
            {// Eventual target will be a list of drinks--show the drink div

                // Set page meta description
                ((DotNetNuke.Framework.CDefault)this.Page).Description = "Browse drink recipes by the drink's alcohol proof.";

                // Set page link canonical tag
                canonicalTag.Href = ConfigurationManager.AppSettings["SiteUrl"] + "drinks/browse/proof";
            }

            ((DotNetNuke.Framework.CDefault)this.Page).Header.Controls.Add(canonicalTag);
        }
开发者ID:charlest704,项目名称:Lad-Solution,代码行数:29,代码来源:AlcoholProof.ascx.cs


示例12: SetStyleSheet

 internal void SetStyleSheet()
 {
     if ((this.LinkedStyleSheets != null) && (this.LinkedStyleSheets.Length > 0))
     {
         if (this.Page.Header == null)
         {
             throw new InvalidOperationException(System.Web.SR.GetString("Page_theme_requires_page_header"));
         }
         int num = 0;
         foreach (string str in this.LinkedStyleSheets)
         {
             HtmlLink child = new HtmlLink {
                 Href = str
             };
             child.Attributes["type"] = "text/css";
             child.Attributes["rel"] = "stylesheet";
             if (this._styleSheetTheme)
             {
                 this.Page.Header.Controls.AddAt(num++, child);
             }
             else
             {
                 this.Page.Header.Controls.Add(child);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:PageTheme.cs


示例13: RegisterEmbeddedClientResource

        /// <summary>
        /// Registers the embedded client resource.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="resourceContainer">The type containing the embedded resource</param>
        /// <param name="resourceName">Name of the resource.</param>
        /// <param name="type">The type.</param>
        public static void RegisterEmbeddedClientResource(this Page page, Type resourceContainer, string resourceName, ClientDependencyType type)
        {
            var target = page.Header;

            // if there's no <head runat="server" /> don't throw an exception.
            if (target != null)
            {
                switch (type)
                {
                    case ClientDependencyType.Css:
                        // get the urls for the embedded resources
                        var resourceUrl = page.ClientScript.GetWebResourceUrl(resourceContainer, resourceName);
                        var link = new HtmlLink();
                        link.Attributes.Add("href", resourceUrl);
                        link.Attributes.Add("type", "text/css");
                        link.Attributes.Add("rel", "stylesheet");
                        target.Controls.Add(link);
                        break;

                    case ClientDependencyType.Javascript:
                        page.ClientScript.RegisterClientScriptResource(resourceContainer, resourceName);
                        break;

                    default:
                        break;
                }
            }
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:35,代码来源:ResourceExtensions.cs


示例14: MakeStyleTag

 private static HtmlLink MakeStyleTag(string path)
 {
     HtmlLink ctrl = new HtmlLink {Href = path};
     ctrl.Attributes.Add("rel", "stylesheet");
     ctrl.Attributes.Add("type", "text/css");
     return ctrl;
 }
开发者ID:ahaverdings,项目名称:SitecoreFieldSuite,代码行数:7,代码来源:RenderFieldSuiteContentEditor.cs


示例15: OnInit

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

			// Check for customization parameters
			ApplicationName = Request.Params["AppName"] ?? ImageServerConstants.DefaultApplicationName;
			SplashScreenUrl = Request.Params["SplashScreenUrl"] ?? DefaultSplashScreenPath;
			CssClassName = Request.Params["CssClassName"];
			CustomCssUrl = Request.Params["CssUrl"];

			if (!string.IsNullOrEmpty(CssClassName))
			{
				this.PageBody.Attributes["class"] += " " + CssClassName;
			}

			if (!string.IsNullOrEmpty(CustomCssUrl))
			{
				// include the custom css (this will append to the end of the list and will overwrite the default css)
				var stylesheet = new HtmlLink { Href = CustomCssUrl };
				stylesheet.Attributes.Add("rel", "stylesheet");
				stylesheet.Attributes.Add("type", "text/css");
				Page.Header.Controls.Add(stylesheet);
			}

        	SetSplashScreen();
			
            ForeachExtension<ILoginPageExtension>(ext => ext.OnLoginPageInit(this));
        }
开发者ID:jasper-yeh,项目名称:ClearCanvas,代码行数:28,代码来源:Default.aspx.cs


示例16: PasswordLengthControl_Load

        private void PasswordLengthControl_Load(object sender, EventArgs e)
        {
            if (this.Page != null)
            {
                if (this.Page.Header != null)
                {
                    if (!this.Page.ClientScript.IsClientScriptBlockRegistered("passCss"))
                    {
                        var link = new HtmlLink
                        {
                            Href = this.Page.ClientScript.GetWebResourceUrl(
                                this.GetType(),
                                "Msts.Content.Chapter09.PasswordStrength.css")
                        };

                        link.Attributes.Add("rel", "stylesheet");
                        link.Attributes.Add("type", "text/css");

                        this.Page.Header.Controls.Add(link);
                        this.Page.ClientScript.RegisterClientScriptBlock(
                            typeof(Page), 
                            "passCss",
                            string.Empty);
                    }
                }
            }
        }
开发者ID:jupaol,项目名称:LearningProjects,代码行数:27,代码来源:PasswordLengthControl.cs


示例17: AddStyleSheet

 public void AddStyleSheet(string id, string href, bool isFirst)
 {
     Control objCSS = this.FindControl("CSS");
     if (objCSS != null)
     {
         Control objCtrl = Page.Header.FindControl(id);
         if (objCtrl == null)
         {
             HtmlLink objLink = new HtmlLink();
             objLink.ID = id;
             objLink.Attributes["rel"] = "stylesheet";
             objLink.Attributes["type"] = "text/css";
             objLink.Href = href;
             if (isFirst)
             {
                 int iLink;
                 for (iLink = 0; iLink <= objCSS.Controls.Count - 1; iLink++)
                 {
                     if (objCSS.Controls[iLink] is HtmlLink)
                     {
                         break;
                     }
                 }
                 objCSS.Controls.AddAt(iLink, objLink);
             }
             else
             {
                 objCSS.Controls.Add(objLink);
             }
         }
     }
 }
开发者ID:jackiechou,项目名称:thegioicuaban.com,代码行数:32,代码来源:CDefault.cs


示例18: CargarCSS

        /// <summary>
        /// Agrega el hmtl link al header del catalogo, del css correspondiente a cargar
        /// </summary>
        protected void CargarCSS()
        {
            string cColor = null;
            HtmlLink link = new HtmlLink();

            sRutaArchivoConfig = Server.MapPath("~/Archivos/Configuracion.xml");
            if (File.Exists(sRutaArchivoConfig))
            {
                oblConfiguracion = new MedNeg.Configuracion.BlConfiguracion();
                cConfiguracion = (MedDAL.Configuracion.DALConfiguracion)oblConfiguracion.CargaDatos(sRutaArchivoConfig);
                try
                {
                    if (!cConfiguracion.sColorInterfaz.Equals(""))
                        cColor = cConfiguracion.sColorInterfaz;
                    else
                        cColor = "Gris";
                }
                catch
                {
                    cColor = "Gris";
                }
            }
            else
                cColor = "Gris";

            link.Href = "Css/" + cColor + ".css";
            link.Attributes.Add("rel", "stylesheet");
            link.Attributes.Add("type", "text/css");
            Page.Header.Controls.Add(link);
        }
开发者ID:jibarradelgado,项目名称:medicuri,代码行数:33,代码来源:InterfazCatalogo.Master.cs


示例19: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {


            // Define an HtmlLink control.
            HtmlLink TableLinkCss = new HtmlLink();
            TableLinkCss.Href = Page.ResolveUrl("~/Manager/css/table/" + Common.TableSink + "/Css.css");
            TableLinkCss.Attributes.Add("rel", "stylesheet");
            TableLinkCss.Attributes.Add("type", "text/css");

            // Add the HtmlLink to the Head section of the page.
            Page.Header.Controls.Add(TableLinkCss);



            HtmlGenericControl CheckLinkJs = new HtmlGenericControl("script");

            CheckLinkJs.Attributes.Add("type", "text/javascript");
            CheckLinkJs.Attributes.Add("src", Page.ResolveUrl("~/Manager/js/checkform.js"));
            CheckLinkJs.Attributes.Add("charset", "utf-8");
            Page.Header.Controls.Add(CheckLinkJs);



            HtmlGenericControl dateLinkJs = new HtmlGenericControl("script");
            dateLinkJs.Attributes.Add("src", Page.ResolveUrl("~/Manager/js/date/date.js"));
            dateLinkJs.Attributes.Add("type", "text/javascript");
            dateLinkJs.Attributes.Add("charset", "utf-8");
            Page.Header.Controls.Add(dateLinkJs);

            Page.Header.Controls[2].Visible = false;


        }
开发者ID:zhanfuzhi,项目名称:shanligitproject,代码行数:34,代码来源:PageTemplate.Master.cs


示例20: AddCssFile

        /// <summary>
        /// Adds the CSS file.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="cssFile">The CSS file.</param>
        public static void AddCssFile(this Page page, string cssFile)
        {
            Assert.ArgumentNotNull(page, "page");
              Assert.ArgumentNotNullOrEmpty(cssFile, "cssFile");

              HtmlLink link = new HtmlLink();
              link.Href = cssFile;

              link.Attributes.Add("rel", "stylesheet");
              link.Attributes.Add("type", "text/css");

              if (page.Header != null)
              {
            try
            {
              if (!IsExistCssInHeader(page, cssFile))
              {
            page.Header.Controls.Add(link);
              }
            }
            catch
            {
              AddToClientScriptManager(page, link);
            }
              }
              else
              {
            AddToClientScriptManager(page, link);
              }
        }
开发者ID:Refactored,项目名称:SitecoreCalendarModule,代码行数:35,代码来源:PageExtensions.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HtmlControls.HtmlMeta类代码示例发布时间:2022-05-26
下一篇:
C# HtmlControls.HtmlInputText类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap