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

C# HtmlControls.HtmlAnchor类代码示例

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

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



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

示例1: AddLink

        public void AddLink(HtmlAnchor link)
        {
            if(HtmlAnchors == null)
                HtmlAnchors = new List<HtmlAnchor>();

            HtmlAnchors.Add(link);
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:7,代码来源:MenuSplitButton.cs


示例2: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            string categoryId = Request.QueryString["categoryId"];

            if (!string.IsNullOrEmpty(categoryId)) {

                // process Home Page link
                HtmlAnchor lnkHome = new HtmlAnchor();
                lnkHome.InnerText = "Home";
                lnkHome.HRef = "~/Default.aspx";
                plhControl.Controls.Add(lnkHome);
                plhControl.Controls.Add(GetDivider());

                // Process Product page link
                HtmlAnchor lnkProducts = new HtmlAnchor();
                lnkProducts.InnerText = WebUtility.GetCategoryName(categoryId);
                lnkProducts.HRef = string.Format(PRODUCTS_URL, categoryId);
                plhControl.Controls.Add(lnkProducts);
                    string productId = Request.QueryString["productId"];
                    if (!string.IsNullOrEmpty(productId)) {

                        // Process Item page link
                        plhControl.Controls.Add(GetDivider());
                        HtmlAnchor lnkItemDetails = new HtmlAnchor();
                        lnkItemDetails.InnerText = WebUtility.GetProductName(productId);
                        lnkItemDetails.HRef = string.Format(ITEMS_URL, categoryId, productId);
                        plhControl.Controls.Add(lnkItemDetails);
                }
            }

            // Add cache dependency
            this.CachePolicy.Dependency = DependencyFacade.GetItemDependency();
        }
开发者ID:kfengbest,项目名称:PetShop,代码行数:33,代码来源:BreadCrumbControl.ascx.cs


示例3: AddEmailAnchor

 private void AddEmailAnchor(Panel p)
 {
     emailAnchor = new HtmlAnchor();
     emailAnchor.ID = "SendEmailAnchor";
     emailAnchor.InnerHtml = "<img src='" + MixERP.Net.Common.Helpers.ConfigurationHelper.GetSectionKey("MixERPReportParameters", "EmailIcon") + "' />";
     p.Controls.Add(emailAnchor);
 }
开发者ID:ravikumr070,项目名称:mixerp,代码行数:7,代码来源:CommandPanel.cs


示例4: AddItem

        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="text">
        /// The text string.
        /// </param>
        /// <param name="url">
        /// The URL string.
        /// </param>
        public void AddItem(string text, string url)
        {
            var a = new HtmlAnchor { InnerHtml = string.Format("<span>{0}</span>", text), HRef = url };

            string adminRootFolder = string.Format("{0}admin", Utils.RelativeWebRoot);
            var startIndx = url.LastIndexOf("/admin/") > 0 ? url.LastIndexOf("/admin/") : 0;
            var endIndx = url.LastIndexOf(".") > 0 ? url.LastIndexOf(".") : url.Length;
            var nodeDir = url.Substring(startIndx, endIndx - startIndx);

            if (Request.RawUrl.IndexOf(nodeDir, StringComparison.OrdinalIgnoreCase) != -1)
            {
                a.Attributes["class"] = "current";
            }

            // if "page" has its own subfolder (comments, extensions) should
            // select parent tab when navigating through child tabs
            if (!SubUrl(Request.RawUrl, true).Equals(adminRootFolder, StringComparison.OrdinalIgnoreCase) &&
                SubUrl(Request.RawUrl, true) == SubUrl(url, false))
            {
                a.Attributes["class"] = "current";
            }

            var li = new HtmlGenericControl("li");
            li.Controls.Add(a);
            ulMenu.Controls.Add(li);
        }
开发者ID:nicknijenhuis,项目名称:Carnaval-Radio,代码行数:35,代码来源:menu.ascx.cs


示例5: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            this.IsLandingPage = true;

            using (HtmlGenericControl header = new HtmlGenericControl("h1"))
            {
                header.InnerText = Titles.RestrictedTransactionMode;
                this.Placeholder1.Controls.Add(header);
            }

            using (HtmlGenericControl divider = HtmlControlHelper.GetDivider())
            {
                this.Placeholder1.Controls.Add(divider);
            }

            using (HtmlGenericControl p = new HtmlGenericControl("p"))
            {
                p.InnerText = Warnings.RestrictedTransactionMode;
                this.Placeholder1.Controls.Add(p);
            }

            using (HtmlAnchor anchor = new HtmlAnchor())
            {
                anchor.InnerText = Titles.BackToPreviousPage;
                anchor.HRef = "javascript:history.go(-1);";
                anchor.Attributes.Add("class", "ui pink button");
                this.Placeholder1.Controls.Add(anchor);
            }
        }
开发者ID:roczj,项目名称:mixerp,代码行数:29,代码来源:RestrictedTransactionMode.aspx.cs


示例6: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (pairs != null && pairs.Count > 0)
            {
                for(int i=0; i<pairs.Count; i++)
                {
                    HtmlGenericControl control = new HtmlGenericControl("li");

                    Pair pair = pairs[i];

                    HtmlAnchor anchor = new HtmlAnchor();
                    anchor.HRef = pair.Second as string;
                    anchor.InnerText = pair.First as string;

                    // assign last anchor id
                    if (i == pairs.Count - 1)
                    {
                        anchor.ID = "__breadcrumb_lastanchor";
                    }

                    control.Controls.Add(anchor);

                    this.breadcrumb.Controls.Add(control);
                }

                HtmlGenericControl emptySpan = new HtmlGenericControl("span");
                emptySpan.InnerHtml = "&nbsp;";
                this.breadcrumb.Controls.Add(emptySpan);

            }
        }
开发者ID:ratnazone,项目名称:ratna,代码行数:31,代码来源:BreadCrumb.ascx.cs


示例7: AddAttachmentAnchor

        private void AddAttachmentAnchor(HtmlGenericControl h)
        {
            if (this.DisplayAttachmentButton)
            {
                if (this.GetTranId().Equals("0"))
                {
                    return;
                }

                if (string.IsNullOrWhiteSpace(this.AttachmentBookName))
                {
                    return;
                }

                string overridePath = this.OverridePath;

                if (string.IsNullOrWhiteSpace(overridePath))
                {
                    overridePath = PageUtility.GetCurrentPageUrl(this.Page);
                }

                string attachmentUrl = string.Format(CultureInfo.InvariantCulture, "~/Modules/BackOffice/AttachmentManager.mix?OverridePath={0}&Book={1}&Id={2}", overridePath, this.AttachmentBookName, this.GetTranId());

                using (HtmlAnchor anchor = new HtmlAnchor())
                {
                    anchor.ID = "AttachmentAnchor";
                    anchor.InnerHtml = "<i class='icon cloud upload'></i>" + Titles.UploadAttachmentsForThisTransaction;
                    anchor.Attributes.Add("class", "item");
                    anchor.HRef = attachmentUrl;

                    h.Controls.Add(anchor);
                }
            }
        }
开发者ID:roczj,项目名称:mixerp,代码行数:34,代码来源:Buttons.cs


示例8: CreateChildControls

        protected override void CreateChildControls()
        {
            if (RenderLink)
            {
                var link = new HtmlAnchor {InnerText = Text, HRef = "#"};
                link.Attributes.Add("onclick", "ImportUsersManager.ShowImportControl();");
                if (!string.IsNullOrEmpty(LinkStyle))
                    link.Attributes.Add("class", LinkStyle);

                Controls.Add(link);
            }
            Controls.Add(Page.LoadControl(ImportUsersTemplate.Location));
            _users = new ImportUsers();
            _users = (ImportUsers)_users.LoadControl(ImportUsers.Location);

            Controls.Add(new LiteralControl("<div id=\"importAreaBlock\" class=\"importAreaBlock\" style=\"display:none\">"));

            _localContainer = new Container { Body = new PlaceHolder(), Header = new PlaceHolder() };
            _localContainer.Body.Controls.Add(_users);
            var html = new HtmlGenericControl("DIV") { InnerHtml = CustomNamingPeople.Substitute<Resources.Resource>("ImportContactsHeader").HtmlEncode() };
            _localContainer.Header.Controls.Add(html);
            Controls.Add(_localContainer);
            Controls.Add(new LiteralControl("</div>"));


            Controls.Add(Page.LoadControl(TariffLimitExceed.Location));

            base.CreateChildControls();

            ChildControlsCreated = true;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:31,代码来源:ImportUsersWebControl.cs


示例9: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            var temp = new Movie();
            var movies = temp.getAll();

            Table table = new Table();
            foreach (int moid in movies.Keys) {
                TableRow row = new TableRow();

                TableCell imageCell = new TableCell();
                Image image = new Image();
                image.ImageUrl = movies[moid].read("imgurl").ToString();

                HtmlAnchor anchor = new HtmlAnchor();
                anchor.HRef = "/show_movie.aspx?moid=" + movies[moid].id;
                anchor.Controls.Add(image);

                imageCell.Controls.Add(anchor);
                row.Controls.Add(imageCell);

                TableCell cell = new TableCell();
                cell.VerticalAlign = VerticalAlign.Top;

                cell.Text = "<h2>" + movies[moid].read("title").ToString() + "</h2>";
                row.Controls.Add(cell);
                cell.Text += (movies[moid].read("description").ToString().Length > 1024) ? movies[moid].read("description").ToString().Substring(0, 1024) + "..." : movies[moid].read("description").ToString();
                row.Controls.Add(cell);

                table.Controls.Add(row);
            }
            PlaceHolder1.Controls.Add(table);
        }
开发者ID:cmol,项目名称:cinemaxxx,代码行数:32,代码来源:show_movies.aspx.cs


示例10: AddedControl

        protected override void AddedControl(System.Web.UI.Control control, int index)
        {
            base.AddedControl(control, index);

            if (control is TabItem)
            {
                if (_ul == null)
                {
                    _ul = new HtmlGenericControl("ul") { EnableViewState = false };
                    Controls.AddAt(0, _ul);

                    _tabItemAnchorDictionary = new Dictionary<TabItem, HtmlAnchor>();
                }

                TabItem tabItem = (TabItem) control;

                HtmlGenericControl li = new HtmlGenericControl("li");
                _ul.Controls.Add(li);

                HtmlAnchor a = new HtmlAnchor();
                li.Controls.Add(a);

                a.HRef = "#" + tabItem.ClientID;
                a.InnerText = tabItem.ToolTip;

                _tabItemAnchorDictionary.Add(tabItem, a);
            }
        }
开发者ID:dpawatts,项目名称:zeus,代码行数:28,代码来源:TabControl.cs


示例11: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     ltrSuccessMessage.Text = "Paymrnt Success ";
     HtmlAnchor anc = new HtmlAnchor();
     anc.HRef = Web.Components.WebConfigSettings.SiteRoot;
     anc.InnerText = "Go to home";
     dvmessage.Controls.Add(anc);
 }
开发者ID:ramrcram,项目名称:CornerSites,代码行数:8,代码来源:Success.aspx.cs


示例12: AddItem

        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="text">
        /// The text string.
        /// </param>
        /// <param name="url">
        /// The URL string.
        /// </param>
        public void AddItem(string text, string url)
        {
            var a = new HtmlAnchor { InnerHtml = string.Format("<span>{0}</span>", text), HRef = url };

            var li = new HtmlGenericControl("li");
            li.Controls.Add(a);
            ulMenu.Controls.Add(li);
        }
开发者ID:rasmuskl,项目名称:ReSharperCourse,代码行数:17,代码来源:menu.ascx.cs


示例13: InstantiateIn

 public void InstantiateIn(Control container)
 {
     selectAnchor = new HtmlAnchor();
     selectAnchor.HRef = "#";
     selectAnchor.Attributes.Add("class", MixERP.Net.Common.Helpers.ConfigurationHelper.GetScrudParameter("ItemSelectorSelectAnchorCssClass"));
     selectAnchor.DataBinding += this.BindData;
     selectAnchor.InnerText = Resources.ScrudResource.Select;
     container.Controls.Add(selectAnchor);
 }
开发者ID:hadoan,项目名称:mixerp,代码行数:9,代码来源:ScrudItemSelectorSelectTemplate.cs


示例14: AddCell

 public void AddCell(TableRow row, string cellText, string hyperlink)
 {
     TableCell cell1 = new TableCell();
     HtmlAnchor anchor1 = new HtmlAnchor();
     anchor1.HRef = hyperlink;
     anchor1.InnerText = cellText;
     cell1.Controls.Add(anchor1);
     row.Cells.Add(cell1);
 }
开发者ID:sidneylimafilho,项目名称:InfoControl,代码行数:9,代码来源:TableHelper.cs


示例15: AppendAnchor

 private static Control AppendAnchor(Control container, string name, string url, bool exists)
 {
     HtmlAnchor a = new HtmlAnchor();
     a.HRef = url;
     a.InnerHtml = name;
     a.Attributes["class"] = exists ? null : "new";
     container.Controls.Add(a);
     return a;
 }
开发者ID:joaohortencio,项目名称:n2cms,代码行数:9,代码来源:InternalLinkRenderer.cs


示例16: InstantiateIn

 public void InstantiateIn(Control container)
 {
     selectAnchor = new HtmlAnchor();
     selectAnchor.HRef = "#";
     selectAnchor.Attributes.Add("class", "linkbutton");//Todo: parameterize this later.
     selectAnchor.DataBinding += this.BindData;
     selectAnchor.InnerText = Resources.ScrudResource.Select;
     container.Controls.Add(selectAnchor);
 }
开发者ID:prabhatjc,项目名称:mixerp,代码行数:9,代码来源:ScrudItemSelectorSelectTemplate.cs


示例17: AddCloseAnchor

 private void AddCloseAnchor(Panel p)
 {
     closeAnchor = new HtmlAnchor();
     closeAnchor.ID = "CloseAnchor";
     closeAnchor.HRef = "#";
     closeAnchor.Attributes.Add("onclick", "window.close();");
     closeAnchor.InnerHtml = "<img src='" + this.Page.ResolveUrl(MixERP.Net.Common.Helpers.ConfigurationHelper.GetReportParameter("CloseIcon")) + "' />";
     p.Controls.Add(closeAnchor);
 }
开发者ID:n4gava,项目名称:mixerp,代码行数:9,代码来源:CommandPanel.cs


示例18: InstantiateIn

        /// <summary>
        /// Creates the template for the repeater item
        /// </summary>
        /// <param name="container"></param>
        public void InstantiateIn(Control container)
        {            
            var itemDiv = new HtmlGenericControl("div");
            itemDiv.ID = "Item";
            itemDiv.Attributes.Add("class", "item");

            var page = (Page)HttpContext.Current.CurrentHandler;
            var imgPreview = (ImageViewer)page.LoadControl(
                string.Concat(SystemDirectories.Umbraco, "/controls/Images/ImageViewer.ascx"));

            imgPreview.ID = "ImgPreview";
            imgPreview.Visible = false; //hidden by default
            imgPreview.ViewerStyle = ImageViewer.Style.Basic;
            itemDiv.Controls.Add(imgPreview);

            var infoBtn = new HtmlAnchor();
            infoBtn.ID = "InfoButton";
            infoBtn.HRef = "javascript:void(0);";
            infoBtn.Attributes.Add("class", "info");
            itemDiv.Controls.Add(infoBtn);

            var innerDiv = new HtmlGenericControl("div");
            innerDiv.ID = "InnerItem";
            innerDiv.Attributes.Add("class", "inner");

            innerDiv.Controls.Add(
                new LiteralControl(@"<ul class=""rightNode"">"));

            var liSelectNode = new HtmlGenericControl("li");
            liSelectNode.Attributes.Add("class", "closed");
            liSelectNode.ID = "SelectedNodeListItem";
            innerDiv.Controls.Add(liSelectNode);

            var selectedNodeLink = new HtmlAnchor();
            selectedNodeLink.ID = "SelectedNodeLink";
            selectedNodeLink.Attributes.Add("class", "sprTree");
            selectedNodeLink.Attributes.Add("title", "Sync tree");
            innerDiv.Controls.Add(selectedNodeLink);

            var selectedNodeText = new Literal();
            selectedNodeText.ID = "SelectedNodeText";
            innerDiv.Controls.Add(selectedNodeText);

            selectedNodeLink.Controls.Add(new LiteralControl("<div>"));
            selectedNodeLink.Controls.Add(selectedNodeText);
            selectedNodeLink.Controls.Add(new LiteralControl("</div>"));

            liSelectNode.Controls.Add(selectedNodeLink);

            innerDiv.Controls.Add(
                new LiteralControl(@"</ul><a class='close' title='Remove' href='javascript:void(0);'></a>"));

            itemDiv.Controls.Add(innerDiv);

            container.Controls.Add(itemDiv);
        }
开发者ID:CarlSargunar,项目名称:Umbraco-CMS,代码行数:60,代码来源:SelectedItemsTemplate.cs


示例19: AttachChildControls

 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["AfficheId"], out this.affichesId))
     {
         base.GotoResourceNotFound();
     }
     this.litAffichesAddedDate = (FormatedTimeLabel) this.FindControl("litAffichesAddedDate");
     this.litContent = (Literal) this.FindControl("litContent");
     this.litTilte = (Literal) this.FindControl("litTilte");
     this.lblFront = (Label) this.FindControl("lblFront");
     this.lblNext = (Label) this.FindControl("lblNext");
     this.aFront = (HtmlAnchor) this.FindControl("front");
     this.aNext = (HtmlAnchor) this.FindControl("next");
     this.lblFrontTitle = (Label) this.FindControl("lblFrontTitle");
     this.lblNextTitle = (Label) this.FindControl("lblNextTitle");
     if (!this.Page.IsPostBack)
     {
         AfficheInfo affiche = CommentBrowser.GetAffiche(this.affichesId);
         if (affiche != null)
         {
             PageTitle.AddTitle(affiche.Title, HiContext.Current.Context);
             this.litTilte.Text = affiche.Title;
             string str = HiContext.Current.HostPath + Globals.GetSiteUrls().UrlData.FormatUrl("AffichesDetails", new object[] { this.affichesId });
             this.litContent.Text = affiche.Content.Replace("href=\"#\"", "href=\"" + str + "\"");
             this.litAffichesAddedDate.Time = affiche.AddedDate;
             AfficheInfo frontOrNextAffiche = CommentBrowser.GetFrontOrNextAffiche(this.affichesId, "Front");
             AfficheInfo info3 = CommentBrowser.GetFrontOrNextAffiche(this.affichesId, "Next");
             if ((frontOrNextAffiche != null) && (frontOrNextAffiche.AfficheId > 0))
             {
                 if (this.lblFront != null)
                 {
                     this.lblFront.Visible = true;
                     this.aFront.HRef = "AffichesDetails.aspx?afficheId=" + frontOrNextAffiche.AfficheId;
                     this.lblFrontTitle.Text = frontOrNextAffiche.Title;
                 }
             }
             else if (this.lblFront != null)
             {
                 this.lblFront.Visible = false;
             }
             if ((info3 != null) && (info3.AfficheId > 0))
             {
                 if (this.lblNext != null)
                 {
                     this.lblNext.Visible = true;
                     this.aNext.HRef = "AffichesDetails.aspx?afficheId=" + info3.AfficheId;
                     this.lblNextTitle.Text = info3.Title;
                 }
             }
             else if (this.lblNext != null)
             {
                 this.lblNext.Visible = false;
             }
         }
     }
 }
开发者ID:davinx,项目名称:himedi,代码行数:56,代码来源:AffichesDetails.cs


示例20: AddTo

 public Control AddTo(Control container, ViewContext context)
 {
     string[] link = context.Fragment.ToString().Trim('[', ']').Split('|');
     HtmlAnchor a = new HtmlAnchor();
     a.HRef = link[0];
     a.InnerHtml = link.Length > 1 ? link[1] : link[0];
     a.Attributes["rel"] = "nofollow"; // fight linkspam
     container.Controls.Add(a);
     return a;
 }
开发者ID:Jobu,项目名称:n2cms,代码行数:10,代码来源:ExternalLinkRenderer.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# HtmlControls.HtmlForm类代码示例发布时间:2022-05-26
下一篇:
C# Design.EditableDesignerRegion类代码示例发布时间: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