Example #1
0
        public static MvcHtmlString JQM_Button(this HtmlHelper htmlHelper, ButtonConfig config)
        {
            TagBuilder tag = null;

            if (config == null || config.Value == null)
            {
                config.Value = string.Empty;
            }

            switch (config.ButtonType)
            {
            case Enums.ButtonType.Button:
                tag = new TagBuilder("button");
                tag.SetInnerText(config.Value.ToString());
                break;

            case Enums.ButtonType.Submit:
            case Enums.ButtonType.Reset:
                tag = new TagBuilder("input");
                break;

            case Enums.ButtonType.Link:
                tag = new TagBuilder("a");
                tag.SetInnerText(config.Value.ToString());
                break;
            }
            config.SetAttributes(tag);

            if (config.ButtonType == Enums.ButtonType.Reset || config.ButtonType == Enums.ButtonType.Submit)
            {
                return(new MvcHtmlString(tag.ToString()));
            }
            else
            {
                return(new MvcHtmlString(tag.ToString()));
            }
        }
Example #2
0
 public static MvcHtmlString JQM_Submit(this HtmlHelper htmlHelper, ButtonConfig config)
 {
     config.ButtonType = Enums.ButtonType.Submit;
     return(JQM_Button(htmlHelper, config));
 }