public static MvcHtmlString BootstrapPasswordFor <TModel, TValue>(
     this HtmlHelper <TModel> htmlHelper,
     Expression <Func <TModel, TValue> > expression,
     HtmlExtensionsCommon.Html5InputTypes type,
     object htmlAttributes = null
     )
 {
     return(BootstrapPasswordFor(htmlHelper,
                                 expression, type, string.Empty, string.Empty, false, false,
                                 string.Empty, htmlAttributes));
 }
예제 #2
0
        public static MvcHtmlString BootstrapPasswordFor <TModel, TValue>
        (
            this HtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TValue> > expression,
            HtmlExtensionsCommon.Html5InputTypes type,
            string title,
            string placeholder,
            bool isRequired,
            bool isAutoFocus,
            string cssClass        = null,
            object htmlAttrributes = null
        )
        {
            // create route value dictionary
            var rvd = new RouteValueDictionary(HtmlHelper
                                               .AnonymousObjectToHtmlAttributes(htmlAttrributes));

            // add all other types here
            rvd.Add("type", type.ToString());

            // other textbox parameters
            if (!string.IsNullOrWhiteSpace(title))
            {
                rvd.Add("title", title);
            }
            if (!string.IsNullOrWhiteSpace(placeholder))
            {
                rvd.Add("placeholder", placeholder);
            }
            if (isRequired)
            {
                rvd.Add("required", "required");
            }
            if (isAutoFocus)
            {
                rvd.Add("autofocus", "autofocus");
            }

            // if there is a cssClass make sure it contains form-control
            if (!string.IsNullOrWhiteSpace(cssClass))
            {
                cssClass = !cssClass.Contains("form-control")
                    ? "form-control " + cssClass
                    : cssClass;
            }
            else
            {
                cssClass = "form-control";
            }

            rvd.Add("class", cssClass);

            return(htmlHelper.PasswordFor(expression, rvd));
        }
 public static MvcHtmlString BoostrapTextBoxFor <TModel, TValue>(
     this HtmlHelper <TModel> htmlHelper,
     Expression <Func <TModel, TValue> > expression,
     HtmlExtensionsCommon.Html5InputTypes inputType,
     string cssClass,
     object htmlAttributes = null
     )
 {
     return(BoostrapTextBoxFor(htmlHelper, expression, inputType,
                               string.Empty, string.Empty,
                               false, false, cssClass, htmlAttributes));
 }
        public static MvcHtmlString BoostrapTextBoxFor <TModel, TValue>(
            this HtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TValue> > expression,
            HtmlExtensionsCommon.Html5InputTypes inputType,
            string title,
            string placeholder,
            bool isRequired,
            bool isAutoFocus,
            string cssClass       = "",
            object htmlAttributes = null
            )
        {
            RouteValueDictionary rvd;

            rvd = new RouteValueDictionary(
                HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));

            rvd.Add("type", inputType.ToString());

            if (!string.IsNullOrEmpty(title))
            {
                rvd.Add("title", title);
            }

            if (!string.IsNullOrEmpty(placeholder))
            {
                rvd.Add("placeholder", placeholder);
            }

            if (isRequired)
            {
                rvd.Add("required", "required");
            }

            if (isAutoFocus)
            {
                rvd.Add("autofocus", "autofocus");
            }

            if (!string.IsNullOrEmpty(cssClass))
            {
                cssClass = "form-control";
            }
            else
            {
                cssClass = "form-control" + cssClass;
            }

            rvd.Add("class", cssClass);

            return(InputExtensions.TextBoxFor(htmlHelper, expression, rvd));
        }
 public static MvcHtmlString BootstrapPasswordFor <TModel, TValue>(
     this HtmlHelper <TModel> htmlHelper,
     Expression <Func <TModel, TValue> > expression,
     HtmlExtensionsCommon.Html5InputTypes type,
     string title,
     string placeholder,
     bool isRequired,
     bool isAutoFocus,
     object htmlAttributes = null
     )
 {
     return(BootstrapPasswordFor(htmlHelper,
                                 expression, type, title, placeholder, isRequired, isAutoFocus,
                                 string.Empty, htmlAttributes));
 }