Model view controller 提交时带有PartialViewResult的MVC表单不会在PartialViewResult中发布数据

Model view controller 提交时带有PartialViewResult的MVC表单不会在PartialViewResult中发布数据,model-view-controller,submit,Model View Controller,Submit,我正在学习mvc和jquery。requirement=>有一些类别。每个类别都可以有一个任务列表。用户应该能够根据自己的意愿通过拖放操作执行任务,并保存到数据库中 我正在处理的表单包含以下内容 元素中显示的类别列表。当用户选择列表项时 发出ajax请求以获取任务列表 列表中显示的任务列表。 保存更改的按钮 我能够实现所有功能,包括显示类别、获取任务和求助。但是保存部分不起作用。当表单发布时,我看不到FormCollection中任务的数据 这是html @using (Html.BeginFo

我正在学习mvc和jquery。requirement=>有一些类别。每个类别都可以有一个任务列表。用户应该能够根据自己的意愿通过拖放操作执行任务,并保存到数据库中

我正在处理的表单包含以下内容

元素中显示的类别列表。当用户选择列表项时 发出ajax请求以获取任务列表 列表中显示的任务列表。 保存更改的按钮 我能够实现所有功能,包括显示类别、获取任务和求助。但是保存部分不起作用。当表单发布时,我看不到FormCollection中任务的数据

这是html

@using (Html.BeginForm("Settings", "Settings", FormMethod.Post, new { id = "formSettings" }))
{
<div style="width: 100%; background-color: Aqua; vertical-align: top">
    <div style="width: 50%; text-align: right; vertical-align: top; float: left; display: block;
        height: 300px;">
        <select id="listSettings"  name="listSettings" style="width:200px;height:280px;text-align:left;" size="@Model.Categories.Count()"  data-tasks="@Url.Action("GetTasks", "Settings", new { })">
            @foreach (string category in @Model.Categories)
            {
                <option title="category"  value="@category">@category</option>
            }
        </select>
    </div>
    <div id="taskListId" style="display: block; width: 30%; float: left; height: 300px;">
        This will be replaced
    </div>
</div>
<div style="text-align: center; width: 100%">
    <input type="submit" id="btnSubmit" title="Save" value="Save" />
</div>
} 
上述内容将由对服务器的ajax调用代替。下面是partialviewresult html

<div id="taskListId" style="display: block; width: 30%; float: left; height: 300px;">
    <ul id="sortable" style="height: 280px;">
        @foreach (string s in Model)
        {
            <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>@s</li>
        }
    </ul>
</div>
提交表单时,为什么表单集合只包含1个键listSettings,而不包含可排序项

如果我做错了什么,请告诉我

谢谢,
拉维。

我想出了一个办法。实际上,表单post中不会包含数据。没有附加名称属性。所以我不会在表单中找到post数据

我通过使用jquery查找和项并将它们作为名称-值对附加到表单post数据来解决这个问题。然后,我使用ajax发布数据