Пример #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));
        }
Пример #2
0
 private static IDictionary <string, object> SetAttributes(DateOptions options, IDictionary <string, object> attrs)
 {
     if (attrs == null)
     {
         attrs = new Dictionary <string, object>();
     }
     attrs.Add("onfocus", "WdatePicker(" + GetDateBoxOptions(options) + ");");
     attrs.Add("autoComplete", "off");
     ClientHelper.AddAttr(attrs, "class", "Wdate");
     return(attrs);
 }