Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MVC-3/jQuery:停止验证我的复选框_Jquery_Asp.net Mvc_Telerik_Jquery Validate_Unobtrusive Validation - Fatal编程技术网

MVC-3/jQuery:停止验证我的复选框

MVC-3/jQuery:停止验证我的复选框,jquery,asp.net-mvc,telerik,jquery-validate,unobtrusive-validation,Jquery,Asp.net Mvc,Telerik,Jquery Validate,Unobtrusive Validation,我有MVC-3用户控制html助手和aspx视图引擎。当我提交表单jQuery时,如何启动非突兀验证&需要我选中所有复选框。我如何预防它 进一步资料: 1我的模型中没有必需的属性 2我在内部使用此复选框 您似乎正在将复选框绑定到name属性。name属性是必需的吗?@StephenMuecke,这只是复选框html helper而不是CheckBoxFor first parameter只是一个要显示的名称,在模型绑定时不会出现在图片中,请更正我的错误。检查html,我怀疑它会呈现`因此验证将应

我有MVC-3用户控制html助手和aspx视图引擎。当我提交表单jQuery时,如何启动非突兀验证&需要我选中所有复选框。我如何预防它

进一步资料:

1我的模型中没有必需的属性

2我在内部使用此复选框


您似乎正在将复选框绑定到name属性。name属性是必需的吗?@StephenMuecke,这只是复选框html helper而不是CheckBoxFor first parameter只是一个要显示的名称,在模型绑定时不会出现在图片中,请更正我的错误。检查html,我怀疑它会呈现`因此验证将应用于名称属性请显示浏览器看到的相关呈现HTML标记。
    namespace Alpha.Views
    {
        public class AlphaCheckBoxControl : ViewUserControl<AlphaCheckBox> { 
    }

    public class AlphaCheckBox
    {
        public bool isChecked;
        public string name { get; set; }
        public MvcHtmlString labelText;
        public bool readOnly;
        public bool visible { get; set; }

        public IDictionary<string, object> htmlAttributes()
        {
            var dict = new Dictionary<string, object>();

            if (readOnly) dict.Add(@"readonly", "readonly");
            if (readOnly) dict.Add("disabled", "disabled");
            return dict;
        }
    }  
}


<%@ Control Language="C#" Inherits="Alpha.Views.AlphaCheckBoxControl" 
        AutoEventWireup="True" CodeBehind="AlphaCheckBox.ascx.cs" %>


<tr>
      <td>
          <%= Html.Label(Model.name)%>
      </td>
      <td>
           <%= Html.CheckBox(Model.name, Model.isChecked, Model.htmlAttributes())%>
      </td>
  </tr>