當前位置: 首頁>>代碼示例>>C#>>正文


C# HtmlControls.HtmlAnchor類代碼示例

本文整理匯總了C#中System.Web.UI.HtmlControls.HtmlAnchor的典型用法代碼示例。如果您正苦於以下問題:C# HtmlAnchor類的具體用法?C# HtmlAnchor怎麽用?C# HtmlAnchor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HtmlAnchor類屬於System.Web.UI.HtmlControls命名空間,在下文中一共展示了HtmlAnchor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的System.Web.UI.HtmlControls.HtmlAnchor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。