Пример #1
0
        public IHtmlString Text(string text)
        {
            var t = new GenericInnerHtmlContainer("p", text, false);

            t.Attrs["class"] += "navbar-text";
            return(t);
        }
Пример #2
0
        public IHtmlString Brand(string text, string url = null)
        {
            var t = new GenericInnerHtmlContainer(string.IsNullOrEmpty(url) ? "p" : "a", text, false);

            t.Attrs["class"] += "navbar-brand";
            if (!string.IsNullOrEmpty(url))
            {
                t.Attrs["href"] = url;
            }
            return(t);
        }
Пример #3
0
        public IHtmlString Link(string text, string url, string identifier, object liHtmlAttrs = null, object aHtmlAttrs = null)
        {
            var a = new GenericInnerHtmlContainer("a", text, false)
            {
                Attrs = new HtmlAttributes(aHtmlAttrs)
            };

            a.Attrs["href"] = url;
            var li = new GenericInnerHtmlContainer("li", a.ToHtmlString(), false)
            {
                Attrs = new HtmlAttributes(liHtmlAttrs)
            };

            if (!string.IsNullOrEmpty(_activeIdentifier))
            {
                var id = string.IsNullOrEmpty(identifier) ? text : identifier;
                if (_activeIdentifier == id)
                {
                    li.Attrs["class"] += "active";
                }
            }
            return(li);
        }