예제 #1
0
        public static MvcHtmlString BootStrapActionLink(
            this HtmlHelper htmlHelper,
            string linkText,
            string actionName,
            ButtonStyle type,
            ButtonSize size,
            object routeValues)
        {
            var actionClass = "btn " + type.GetAttribute<XmlEnumAttribute>().Name + " "
                              + size.GetAttribute<XmlEnumAttribute>().Name;

            return htmlHelper.ActionLink(linkText, actionName, routeValues, new { @class = actionClass });
        }
예제 #2
0
        public static MvcHtmlString BootStrapSubmitButton(
            this HtmlHelper html,
            string text,
            ButtonStyle type,
            ButtonSize size,
            object routeValues)
        {
            var buttonClass = "btn " + type.GetAttribute<XmlEnumAttribute>().Name + " "
                            + size.GetAttribute<XmlEnumAttribute>().Name;

            var builder = new TagBuilder("input");

            builder.Attributes.Add("type", "submit");

            builder.Attributes.Add("class", buttonClass);

            builder.Attributes.Add("value", text);

            builder.MergeAttributes(new RouteValueDictionary(routeValues));

            return MvcHtmlString.Create(builder.ToString(TagRenderMode.SelfClosing));
        }