Beispiel #1
0
        public static MvcHtmlString GovUkPostCodeInputFor <TModel, TProperty>(
            this HtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > expression,
            string buttonText        = null,
            bool hideLabel           = false,
            bool hasCustomValidation = false)
        {
            var validationAttributes = htmlHelper.GetValidationAttributes(expression);
            var hasValidation        = hasCustomValidation || validationAttributes.Count > 0;

            var html = new StringBuilder();

            html.Append(TextInputHtml.GenerateCustomTextInputFor(htmlHelper, expression, new { @class = "form-control form-control-1-8 post-code" }, validationAttributes));

            if (!string.IsNullOrEmpty(buttonText))
            {
                html.Append(string.Format(" <input type=\"submit\" id=\"FindAddress\" name=\"FindAddress\" class=\"button\" value=\"{0}\">", buttonText));
            }

            return(ControlContainerHtml.GenerateSingleContainer(
                       htmlHelper,
                       expression,
                       new MvcHtmlString(html.ToString()),
                       hideLabel,
                       hasValidation));
        }
Beispiel #2
0
        public static MvcHtmlString GovUkRadioListForEnum <TModel, TProperty>(
            this HtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > expression,
            bool hasCustomValidation = false)
        {
            var validationAttributes = htmlHelper.GetValidationAttributes(expression);
            var hasValidation        = hasCustomValidation || validationAttributes.Count > 0;

            return(ControlContainerHtml.GenerateGroupContainer(
                       htmlHelper,
                       expression,
                       RadioListHtml.GenerateRadioListForEnum(htmlHelper, expression),
                       hasValidation));
        }
Beispiel #3
0
        public static MvcHtmlString GovUkTextInputFor <TModel, TProperty>(
            this HtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > expression,
            bool hideLabel           = false,
            bool hasCustomValidation = false)
        {
            var validationAttributes = htmlHelper.GetValidationAttributes(expression);
            var hasValidation        = hasCustomValidation || validationAttributes.Count > 0;

            return(ControlContainerHtml.GenerateSingleContainer(
                       htmlHelper,
                       expression,
                       TextInputHtml.GenerateTextInputFor(htmlHelper, expression, validationAttributes),
                       hideLabel,
                       hasValidation));
        }
Beispiel #4
0
        public static MvcHtmlString GovUkDropDownListFor <TModel, TProperty>(
            this HtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > expression,
            Dictionary <string, string> dictionarylist,
            bool hasCustomValidation = false)
        {
            var validationAttributes = htmlHelper.GetValidationAttributes(expression);
            var hasValidation        = hasCustomValidation || validationAttributes.Count > 0;

            return(ControlContainerHtml.GenerateSingleContainer(
                       htmlHelper,
                       expression,
                       DropDownListHtml.GenerateDropDownList(htmlHelper, expression, dictionarylist),
                       false,
                       hasValidation));
        }
        public static MvcHtmlString GovUkCustomTextAreaInputFor <TModel, TProperty>(
            this HtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > expression,
            object customFieldAttributes,
            int rows                 = 4,
            int cols                 = 30,
            bool hideLabel           = false,
            bool hasCustomValidation = false)
        {
            var validationAttributes = htmlHelper.GetValidationAttributes(expression);
            var hasValidation        = hasCustomValidation || validationAttributes.Count > 0;

            return(ControlContainerHtml.GenerateSingleContainer(
                       htmlHelper,
                       expression,
                       TextAreaInputHtml.GenerateCustomTextAreaInputFor(htmlHelper, expression, customFieldAttributes, rows, cols, validationAttributes),
                       hideLabel,
                       hasValidation));
        }