Пример #1
0
        public static MvcHtmlString TextBoxFor <TModel, TProperty>(this BootstrapHelper <TModel> html, Expression <Func <TModel, TProperty> > expression)
        {
            var    model = (TModel)html.ViewData.Model;
            string propertyName;
            object value;

            InputExtensions.GetValueByExpression <TModel, TProperty>(expression, model, out propertyName, out value);
            return(InputExtensions.Helper(html, InputType.Text, propertyName, propertyName, value, false, null));
        }
Пример #2
0
        /// <summary>
        /// 通过使用指定的 HTML 帮助器和窗体字段的名称,返回文本框标签
        /// </summary>
        /// <param name="html">扩展方法实例</param>
        /// <param name="name">表单元素的name属性值</param>
        /// <param name="value">表单元素的value值</param>
        /// <param name="placeholder">bootstrap自带的文本框的提示输入值</param>
        /// <param name="htmlAttributes">额外属性</param>
        /// <returns>返回input type='text'标签</returns>
        public static MvcHtmlString TextBox(this BootstrapHelper html, string id, string name, object value, string placeholder, object htmlAttributes)
        {
            IDictionary <string, object> attributes = BootstrapHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);

            if (!string.IsNullOrEmpty(placeholder))
            {
                attributes.Add("placeholder", placeholder);
            }
            return(InputExtensions.Helper(html, InputType.Text, id, name, value, false, attributes));
        }
Пример #3
0
        /// <summary>
        /// 返回表单CheckBox标签
        /// </summary>
        /// <param name="html">扩展方法实例</param>
        /// <param name="id">id</param>
        /// <param name="name">name属性</param>
        /// <param name="value">input的value值</param>
        /// <param name="text">显示文本</param>
        /// <param name="labelClass">label标签的样式</param>
        /// <param name="isCheck">是否选中</param>
        /// <param name="isDisabled">是否禁用</param>
        /// <param name="oAttributes">额外标签</param>
        /// <returns>返回CheckBox标签</returns>
        public static MvcHtmlString CheckBox(this BootstrapHelper html, string id, string name, object value, string text, string labelClass, bool isCheck, bool isDisabled, object oAttributes)
        {
            IDictionary <string, object> htmlAttributes = null;

            if (oAttributes != null)
            {
                htmlAttributes = BootstrapHelper.AnonymousObjectToHtmlAttributes(oAttributes);
            }
            else
            {
                htmlAttributes = new Dictionary <string, object>();
            }
            return(InputExtensions.CheckBox(html, InputType.CheckBox, id, name, value, text, labelClass, isCheck, isDisabled, htmlAttributes));
        }
Пример #4
0
        /// <summary>
        /// 通过使用指定的 HTML 帮助器和窗体字段的名称,返回文本框标签
        /// </summary>
        /// <param name="html">扩展方法实例</param>
        /// <param name="name">单元素的name属性值</param>
        /// <param name="value">表单元素的value值</param>
        /// <param name="htmlAttributes">额外属性</param>
        /// <returns>返回input type='text'标签</returns>
        public static MvcHtmlString TextBox(this BootstrapHelper html, string id, string name, object value, object htmlAttributes)
        {
            IDictionary <string, object> attributes = BootstrapHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);

            return(InputExtensions.Helper(html, InputType.Text, id, name, value, false, attributes));
        }
Пример #5
0
 /// <summary>
 /// 通过使用指定的 HTML 帮助器和窗体字段的名称,返回文本框标签
 /// </summary>
 /// <param name="html">扩展方法实例</param>
 /// <param name="name">单元素的name属性值</param>
 /// <param name="value">表单元素的value值</param>
 /// <returns>返回input type='text'标签</returns>
 public static MvcHtmlString TextBox(this BootstrapHelper html, string id, string name, object value)
 {
     return(InputExtensions.Helper(html, InputType.Text, id, name, value, false, null));
 }