使用 JQuery 可排序,并尝试将新订单发送回我的控制器,但运气不佳。我的看法是:
using (Ajax.BeginForm("EditTickerOrder", new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "POST", }))
{
<div id="editableticker">
@Html.HiddenFor(m => m.ProjectGUID)
<ul id="sortablediv">
@foreach (DGI.CoBRA.Tools.BussinessObjects.CollabLibrary.TickerObjects.Ticker t in Model)
{
<li class="ui-state-default" id="@t.pKeyGuid.ToString()">
<p>@Html.CheckBox(t.pKeyGuid.ToString(), t.Display, new { @class = "activechk" })
<span style="font-weight: bold">
@t.Text
</span>
</p>
</li>
}
</ul>
<input type="submit" value="Save New Ticker Order" />
}
我的控制器是:
[HttpPost]
public ActionResult EditTickerOrder(Guid ProjectGUID, List<string> items)
{
TickerCollectionModel TickerData = new TickerCollectionModel();
TickerData.ProjectGUID = ProjectGUID;
TickerData.ListAllBySession(ProjectGUID);
return PartialView("TickerList", TickerData);
}
然而list<string> items
总是如此null
。有任何想法吗?