Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.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
Asp.net mvc 2 MVC Html.CheckBox列表和Jquery帖子_Asp.net Mvc 2 - Fatal编程技术网

Asp.net mvc 2 MVC Html.CheckBox列表和Jquery帖子

Asp.net mvc 2 MVC Html.CheckBox列表和Jquery帖子,asp.net-mvc-2,Asp.net Mvc 2,我的代码是 <% using (Html.BeginForm()) {%> <table> <tr> <th> LabelID_FK </th> <th> LabelName </th> &

我的代码是

 <% using (Html.BeginForm())
       {%>
    <table>
        <tr>

            <th>
                LabelID_FK
            </th>
            <th>
                LabelName
            </th>
            <th>
                LabelIsDocument
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>

            <td>
                <%: item.LabelID_FK %>
            </td>
            <td>
                <%: item.LabelName %>
            </td>
            <td>
              <%--  <input type="checkbox" value="df" id="chk" onclick="check()" />--%>
                <%=Html.CheckBox("chk_"+ item.LabelID_FK)%>
            </td>
        </tr>
        <% } %>
    </table>
    <p>
        <input type="button" value="submit" id="btn" />
    </p>

LabelID_FK
标签名
LabelIsDocument

显示用户可以选择的文档标签的复选框列表。 我想传递数据列表,让哪个用户选中它使用jquerypost的复选框
我该怎么做?

当用户单击按钮时,我会使用此代码,并且工作得非常好

[HttpPost]
        public ActionResult DocumentLabel(FormCollection model)
        {


            for (int i = 0; i < model.Count; i++)
            {
                AriaCRMEntities aria = new AriaCRMEntities();
                DocumentLabel label = new DocumentLabel();
                string lbl = model[i].ToString();
                string[] check = lbl.Split(',');

                bool chk = Convert.ToBoolean(check[0]);

                string name = model.Keys[i].ToString();
                string[] n = name.Split('_');
                string lblid = n[1];

                if (chk)
                {
                    label.LabelID_FK = Int32.Parse(lblid);
                    Guid id = Guid.NewGuid();
                    label.DocumentID_FK = id;

                    aria.DocumentLabels.AddObject(label);
                    aria.SaveChanges();
                }

            }


            return Content("0ok");
        }
[HttpPost]
公共操作结果文档标签(FormCollection模型)
{
for(int i=0;i
但我想要jquery post我需要数组复选框,选择它将其传递给控制器