Example #1
0
        public static MvcHtmlString InputBox(this HtmlHelper helper, string name, string value, ValidOptions valid, object htmlAttributes)
        {
            IDictionary <string, object> dic = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);

            ClientHelper.AddAttr(dic, "class", "textbox easyui-validatebox");
            if (valid != null)
            {
                if (valid.Required)
                {
                    ClientHelper.AddAttr(dic, "required", "true");
                }
                if (valid.ValidType.HasValue)
                {
                    string vt = valid.ValidType.ToString().ToLower();
                    switch (valid.ValidType)
                    {
                    case ValidType.Length: vt = vt + "[" + valid.Length + "]"; break;

                    case ValidType.Remote: vt = vt + "[" + valid.Remote + "]"; break;
                    }
                    ClientHelper.AddAttr(dic, "validType", vt);
                }
            }
            return(helper.TextBox(name, value, dic));
        }
Example #2
0
 public static MvcHtmlString InputBox(this HtmlHelper helper, string name, string value, ValidOptions valid)
 {
     return(InputBox(helper, name, value, valid, null));
 }