public void Button(string text, BootstrapNamedColor cssClass, string onClick, object htmlAttributes) { var builder = new TagBuilder("input"); builder.MergeAttribute("type", "button"); builder.MergeAttribute("value", text); if (!string.IsNullOrEmpty(onClick)) { builder.MergeAttribute("onclick", onClick); } builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); switch (cssClass) { case BootstrapNamedColor.Important: builder.AddCssClass("btn btn-danger"); break; case BootstrapNamedColor.Default: builder.AddCssClass("btn"); break; case BootstrapNamedColor.Info: builder.AddCssClass("btn btn-info"); break; case BootstrapNamedColor.Inverse: builder.AddCssClass("btn btn-inverse"); break; case BootstrapNamedColor.Primary: builder.AddCssClass("btn btn-primary"); break; case BootstrapNamedColor.Success: builder.AddCssClass("btn btn-success"); break; case BootstrapNamedColor.Warning: builder.AddCssClass("btn btn-warning"); break; default: builder.AddCssClass("btn"); break; } this.textWriter.Write(builder.ToString(TagRenderMode.SelfClosing)); }
public void Button(string text, BootstrapNamedColor cssClass, string onClick, object htmlAttributes) { var builder = new TagBuilder("input"); builder.MergeAttribute("type", "button"); builder.MergeAttribute("value", text); if (!string.IsNullOrEmpty(onClick)) { builder.MergeAttribute("onclick", onClick); } builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); switch (cssClass) { case BootstrapNamedColor.Important: builder.AddCssClass("btn btn-danger"); break; case BootstrapNamedColor.Default: builder.AddCssClass("btn"); break; case BootstrapNamedColor.Info: builder.AddCssClass("btn btn-info"); break; case BootstrapNamedColor.Inverse: builder.AddCssClass("btn btn-inverse"); break; case BootstrapNamedColor.Primary: builder.AddCssClass("btn btn-primary"); break; case BootstrapNamedColor.Success: builder.AddCssClass("btn btn-success"); break; case BootstrapNamedColor.Warning: builder.AddCssClass("btn btn-warning"); break; default: builder.AddCssClass("btn"); break; } this.textWriter.Write(builder.ToString(TagRenderMode.SelfClosing)); }
public MvcHtmlString InlineLabel(string text, BootstrapNamedColor color, object htmlAttributes = null) { var builder = new TagBuilder("span"); builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); switch (color) { case BootstrapNamedColor.Important: builder.AddCssClass("label label-important"); break; case BootstrapNamedColor.Default: builder.AddCssClass("label"); break; case BootstrapNamedColor.Info: builder.AddCssClass("label label-info"); break; case BootstrapNamedColor.Inverse: builder.AddCssClass("label label-inverse"); break; case BootstrapNamedColor.Primary: builder.AddCssClass("label label-primary"); break; case BootstrapNamedColor.Success: builder.AddCssClass("label label-success"); break; case BootstrapNamedColor.Warning: builder.AddCssClass("label label-warning"); break; default: builder.AddCssClass("label"); break; } builder.InnerHtml = text; return(MvcHtmlString.Create(builder.ToString())); }
public MvcHtmlString ActionButton(string text, BootstrapNamedColor color, string actionName, string controllerName, object routeValues, object htmlAttributes) { var builder = new TagBuilder("a"); builder.SetInnerText(text); builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); switch (color) { case BootstrapNamedColor.Important: builder.AddCssClass("btn btn-danger"); break; case BootstrapNamedColor.Default: builder.AddCssClass("btn"); break; case BootstrapNamedColor.Info: builder.AddCssClass("btn btn-info"); break; case BootstrapNamedColor.Inverse: builder.AddCssClass("btn btn-inverse"); break; case BootstrapNamedColor.Primary: builder.AddCssClass("btn btn-primary"); break; case BootstrapNamedColor.Success: builder.AddCssClass("btn btn-success"); break; case BootstrapNamedColor.Warning: builder.AddCssClass("btn btn-warning"); break; default: builder.AddCssClass("btn"); break; } var urlHelper = new UrlHelper(_helper.ViewContext.RequestContext); builder.MergeAttribute("href", urlHelper.Action(actionName, controllerName, routeValues)); return(MvcHtmlString.Create(builder.ToString())); }
public MvcHtmlString SubmitButton(string text, BootstrapNamedColor color, object htmlAttributes) { var builder = new TagBuilder("button"); builder.MergeAttribute("type", "submit"); //builder.MergeAttribute("value", text); builder.SetInnerText(text); builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); switch (color) { case BootstrapNamedColor.Important: builder.AddCssClass("btn btn-danger"); break; case BootstrapNamedColor.Default: builder.AddCssClass("btn"); break; case BootstrapNamedColor.Info: builder.AddCssClass("btn btn-info"); break; case BootstrapNamedColor.Inverse: builder.AddCssClass("btn btn-inverse"); break; case BootstrapNamedColor.Primary: builder.AddCssClass("btn btn-primary"); break; case BootstrapNamedColor.Success: builder.AddCssClass("btn btn-success"); break; case BootstrapNamedColor.Warning: builder.AddCssClass("btn btn-warning"); break; default: builder.AddCssClass("btn"); break; } return(MvcHtmlString.Create(builder.ToString())); }
public static MvcHtmlString ButtonWithinGroup(this HtmlHelper helper, string text, string actionName, string controllerName, object routeValues = null, object htmlAttributes = null, string glyphIcons = null, BootstrapNamedColor color = BootstrapNamedColor.Default) { var builder = new TagBuilder("li"); var buttonHtml = helper.ActionButton(text, actionName, controllerName, routeValues, htmlAttributes, glyphIcons, color); builder.InnerHtml = buttonHtml.ToHtmlString(); return MvcHtmlString.Create(builder.ToString()); }
public static MvcHtmlString ActionButton(this HtmlHelper helper, string text, string actionName, string controllerName, object routeValues = null, object htmlAttributes = null, string glyphIcons = null, BootstrapNamedColor color = BootstrapNamedColor.Default) { var builder = new TagBuilder("a"); builder.SetInnerText(text); builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); switch (color) { case BootstrapNamedColor.Important: builder.AddCssClass("btn btn-danger"); break; case BootstrapNamedColor.Default: builder.AddCssClass("btn"); break; case BootstrapNamedColor.Info: builder.AddCssClass("btn btn-info"); break; case BootstrapNamedColor.Inverse: builder.AddCssClass("btn btn-inverse"); break; case BootstrapNamedColor.Primary: builder.AddCssClass("btn btn-primary"); break; case BootstrapNamedColor.Success: builder.AddCssClass("btn btn-success"); break; case BootstrapNamedColor.Warning: builder.AddCssClass("btn btn-warning"); break; default: builder.AddCssClass("btn"); break; } builder.AddCssClass("text-left"); var urlHelper = new UrlHelper(helper.ViewContext.RequestContext); builder.MergeAttribute("href", urlHelper.Action(actionName, controllerName, routeValues)); if (!string.IsNullOrEmpty(glyphIcons)) { var glyphiconBuilder = new TagBuilder("span"); glyphiconBuilder.AddCssClass("pull-right glyphicon glyph" + glyphIcons); builder.InnerHtml = glyphiconBuilder + " " + builder.InnerHtml; } return(MvcHtmlString.Create(builder.ToString())); }
public static MvcHtmlString Divider(this HtmlHelper helper, string text, string actionName, string controllerName, object routeValues = null, object htmlAttributes = null, string glyphIcons = null, BootstrapNamedColor color = BootstrapNamedColor.Default) { var builder = new TagBuilder("li"); builder.AddCssClass("divider"); return MvcHtmlString.Create(builder.ToString()); }
public static MvcHtmlString Divider(this HtmlHelper helper, string text, string actionName, string controllerName, object routeValues = null, object htmlAttributes = null, string glyphIcons = null, BootstrapNamedColor color = BootstrapNamedColor.Default) { var builder = new TagBuilder("li"); builder.AddCssClass("divider"); return(MvcHtmlString.Create(builder.ToString())); }
public static MvcHtmlString ButtonWithinGroup(this HtmlHelper helper, string text, string actionName, string controllerName, object routeValues = null, object htmlAttributes = null, string glyphIcons = null, BootstrapNamedColor color = BootstrapNamedColor.Default) { var builder = new TagBuilder("li"); MvcHtmlString buttonHtml = helper.ActionButton(text, actionName, controllerName, routeValues, htmlAttributes, glyphIcons, color); builder.InnerHtml = buttonHtml.ToHtmlString(); return(MvcHtmlString.Create(builder.ToString())); }
public static MvcHtmlString ActionButton(this HtmlHelper helper, string text, string actionName, string controllerName, object routeValues = null, object htmlAttributes = null, string glyphIcons = null, BootstrapNamedColor color = BootstrapNamedColor.Default) { var builder = new TagBuilder("a"); builder.SetInnerText(text); builder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); switch (color) { case BootstrapNamedColor.Important: builder.AddCssClass("btn btn-danger"); break; case BootstrapNamedColor.Default: builder.AddCssClass("btn"); break; case BootstrapNamedColor.Info: builder.AddCssClass("btn btn-info"); break; case BootstrapNamedColor.Inverse: builder.AddCssClass("btn btn-inverse"); break; case BootstrapNamedColor.Primary: builder.AddCssClass("btn btn-primary"); break; case BootstrapNamedColor.Success: builder.AddCssClass("btn btn-success"); break; case BootstrapNamedColor.Warning: builder.AddCssClass("btn btn-warning"); break; default: builder.AddCssClass("btn"); break; } builder.AddCssClass("text-left"); var urlHelper = new UrlHelper(helper.ViewContext.RequestContext); builder.MergeAttribute("href", urlHelper.Action(actionName, controllerName, routeValues)); if (!string.IsNullOrEmpty(glyphIcons)) { var glyphiconBuilder = new TagBuilder("span"); glyphiconBuilder.AddCssClass("pull-right glyphicon glyph" + glyphIcons); builder.InnerHtml = glyphiconBuilder + " " + builder.InnerHtml; } return MvcHtmlString.Create(builder.ToString()); }
public void Button(string text, BootstrapNamedColor cssClass, string onClick) { Button(text, cssClass, onClick, null); }
public void Button(string text, BootstrapNamedColor cssClass) { Button(text, cssClass, null); }
public MvcHtmlString ActionButton(string text, BootstrapNamedColor color, string actionName, string controllerName, object routeValues) { return(ActionButton(text, color, actionName, controllerName, routeValues, null)); }
public MvcHtmlString SubmitButton(string text, BootstrapNamedColor color) { return(SubmitButton(text, color, null)); }
public MvcHtmlString Button(string text, BootstrapNamedColor color, string onClick) { return(Button(text, color, onClick, null)); }
public void Button(string text, BootstrapNamedColor cssClass, string onClick) { Button(text, cssClass, onClick, null); }
public void Button(string text, BootstrapNamedColor cssClass) { Button(text, cssClass, null); }