public CarouselCaptionPanel ItemWithCaption(string url, string altText, object htmlAttributes = null)
        {
            if (isFirstItem)
            {
                base.textWriter.Write(@"<div class=""item active"">");
                isFirstItem = false;
            }
            else
            {
                base.textWriter.Write(@"<div class=""item"">");
            }

            var imgBuilder = new TagBuilder("img");

            imgBuilder.MergeAttributes(HtmlAttributesUtility.ObjectToHtmlAttributesDictionary(htmlAttributes));
            imgBuilder.MergeAttribute("src", urlHelper.Content(url));
            imgBuilder.MergeAttribute("alt", altText);
            base.textWriter.Write(imgBuilder.ToString(TagRenderMode.SelfClosing));
            return(new CarouselCaptionPanel(base.textWriter));
        }
Ejemplo n.º 2
0
 // Methods
 internal HtmlElement(string tag, object htmlAttributes)
 {
     this.tag            = tag;
     this.htmlAttributes = HtmlAttributesUtility.ObjectToHtmlAttributesDictionary(htmlAttributes);
 }