Пример #1
0
        /// <summary>
        /// 为 <see cref="HtmlHelper"/> 对象扩展 textbox 元素。
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="exp">属性名或使用 txt 作为前缀的 ID 名称。</param>
        /// <param name="settings">参数选项。</param>
        /// <returns></returns>
        public static HtmlHelper TextBox(this HtmlHelper htmlHelper, string exp, TextBoxSettings settings = null)
        {
            var options = SettingsSerializer.Serialize(settings);

            htmlHelper.ResetBuilderWithCheck("INPUT", "txt", exp);
            htmlHelper.AddStyle("width", "160px")
            .EasyUI("easyui-textbox", options);

            return(htmlHelper);
        }
Пример #2
0
        /// <summary>
        /// 为 <see cref="HtmlHelper"/> 对象扩展 validatebox 元素。
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="id">ID 属性值。</param>
        /// <param name="settings">参数选项。</param>
        /// <returns></returns>
        public static HtmlHelper <TModel> ValidatePasswordBox <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, TextBoxSettings settings = null)
        {
            var metadata     = new ModelPropertyBinder(expression);
            var propertyName = metadata.PropertyName;

            settings           = settings ?? new TextBoxSettings();
            settings.Multiline = true;
            settings.Bind(typeof(TModel), propertyName);
            var options = SettingsSerializer.Serialize(settings);

            htmlHelper.ResetBuilder("INPUT", "txt" + propertyName, propertyName);
            htmlHelper.Builder.TagClosed = true;
            htmlHelper.AddAttribute("type", "password")
            .AddStyle("width", "160px")
            .EasyUI("easyui-textbox", options);

            return(htmlHelper);
        }
Пример #3
0
        /// <summary>
        /// 为 <see cref="HtmlHelper"/> 对象扩展 textbox 元素。
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="exp">属性名或使用 txt 作为前缀的 ID 名称。</param>
        /// <param name="settings">参数选项。</param>
        /// <returns></returns>
        public static HtmlHelper TextMultiBox(this HtmlHelper htmlHelper, string exp, TextBoxSettings settings = null)
        {
            settings           = settings ?? new TextBoxSettings();
            settings.Multiline = true;
            var options = SettingsSerializer.Serialize(settings);

            htmlHelper.ResetBuilderWithCheck("TEXTAREA", "txt", exp);
            htmlHelper.Builder.TagClosed = true;
            htmlHelper.AddStyle("width", "300px")
            .AddStyle("height", "40px")
            .EasyUI("easyui-textbox", options);

            return(htmlHelper);
        }
Пример #4
0
        /// <summary>
        /// 为 <see cref="HtmlHelper"/> 对象扩展 textbox 元素。
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="exp">属性名或使用 txt 作为前缀的 ID 名称。</param>
        /// <param name="settings">参数选项。</param>
        /// <returns></returns>
        public static HtmlHelper TextPasswordBox(this HtmlHelper htmlHelper, string exp, TextBoxSettings settings = null)
        {
            settings      = settings ?? new TextBoxSettings();
            settings.Type = "password";
            var options = SettingsSerializer.Serialize(settings);

            htmlHelper.ResetBuilderWithCheck("INPUT", "txt", exp);
            htmlHelper.Builder.TagClosed = true;
            htmlHelper.AddAttribute("type", "password")
            .AddStyle("width", "160px")
            .EasyUI("easyui-textbox", options);

            return(htmlHelper);
        }