Exemplo n.º 1
0
        /// <summary>
        /// Renders the HTML contents of the control into the specified <paramref name="writer"/>.
        /// </summary>
        /// <param name="writer">A <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            for (int i = 0; i < this.Items.Count; i++)
            {
                BreadcrumbsItem item = this.Items[i];

                if (i == (this.Items.Count - 1))
                {
                    item.NavigateUrl = "";
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "active");
                    writer.AddAttribute("aria-current", "page");
                }

                if (AddSchemaMarkup)
                {
                    writer.AddAttribute("itemscope", String.Empty);
                    writer.AddAttribute("itemtype", "http://schema.org/ListItem");
                    writer.AddAttribute("itemprop", "itemListElement");
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Li);
                item.RenderControl(writer);

                if (AddSchemaMarkup)
                {
                    writer.AddAttribute("content", (i + 1).ToString());
                    writer.AddAttribute("itemprop", "position");
                    writer.RenderBeginTag(HtmlTextWriterTag.Meta);
                    writer.RenderEndTag();
                }
                writer.RenderEndTag();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's <see cref="T:System.Web.UI.ControlCollection" /> object.
        /// </summary>
        /// <param name="obj">An <see cref="T:System.Object" /> that represents the parsed element.</param>
        protected override void AddParsedSubObject(object obj)
        {
            BreadcrumbsItem crumb = obj as BreadcrumbsItem;

            if (crumb != null)
            {
                Items.Add(crumb);
            }
        }