private static BootstrapAlert BeginAlertHelper(this HtmlHelper html, string alertClassName, string title, string id, string className)
		{
			TagBuilder tag = new TagBuilder("div");
			tag.AddOrMergeAttribute("class", "alert");

			if (!String.IsNullOrEmpty(alertClassName))
				tag.AddOrMergeAttribute("class", alertClassName);

			if (!String.IsNullOrEmpty(className))
				tag.AddOrMergeAttribute("class", className);

			if (!String.IsNullOrEmpty(id))
				tag.Attributes.Add("id", id);

			html.ViewContext.Writer.Write(tag.ToString(TagRenderMode.StartTag));

			if (!String.IsNullOrEmpty(title))
			{
				TagBuilder titleTag = new TagBuilder("h4");
				titleTag.MergeAttribute("class", "alert-heading");
				titleTag.SetInnerText(title);
				html.ViewContext.Writer.Write(titleTag.ToString(TagRenderMode.Normal));
			}

			BootstrapAlert theAlert = new BootstrapAlert(html.ViewContext);
			return theAlert;
		}
Ejemplo n.º 2
0
        private static BootstrapAlert BeginAlertHelper(this HtmlHelper html, string alertClassName, string title, string id, string className)
        {
            TagBuilder tag = new TagBuilder("div");

            tag.AddOrMergeAttribute("class", "alert");

            if (!String.IsNullOrEmpty(alertClassName))
            {
                tag.AddOrMergeAttribute("class", alertClassName);
            }

            if (!String.IsNullOrEmpty(className))
            {
                tag.AddOrMergeAttribute("class", className);
            }

            if (!String.IsNullOrEmpty(id))
            {
                tag.Attributes.Add("id", id);
            }

            html.ViewContext.Writer.Write(tag.ToString(TagRenderMode.StartTag));

            if (!String.IsNullOrEmpty(title))
            {
                TagBuilder titleTag = new TagBuilder("h4");
                titleTag.MergeAttribute("class", "alert-heading");
                titleTag.SetInnerText(title);
                html.ViewContext.Writer.Write(titleTag.ToString(TagRenderMode.Normal));
            }

            BootstrapAlert theAlert = new BootstrapAlert(html.ViewContext);

            return(theAlert);
        }