我在表单中使用回调面板,当Combobox值更改时,CallbackPanel内的字段值应相应更新。
我的问题是控制器内的模型值总是为空,我不知道为什么! (model.Documents = null,model.SelectedDocument = null)
如果有人可以告诉我我的问题在哪里以及如何解决它,那将会很棒。
这是我的代码(已编辑):
查看
@using (Html.BeginForm("Finalize", "DocumentsWaitingApproval", FormMethod.Post, Model))
{
<table>
<tr>
<td>
@Html.DevExpress().ComboBox(settings =>
{
settings.SelectedIndex = 0;
settings.Properties.TextField = "Title";
settings.ClientEnabled = true;
settings.Properties.ClientInstanceName = "CmbBoxFiles";
settings.Properties.EnableClientSideAPI = true;
settings.Properties.ValueType = typeof(int);
settings.Properties.ValueField = "DocumentID";
settings.Name = "CmbBoxFiles";
settings.Properties.ClientSideEvents.SelectedIndexChanged = "function(s,e) { cmbBoxFiles_SelectedIndexChanged(s,e); }";
}).BindList(Model.Documents).GetHtml()
</td>
</tr>
</table>
@Html.DevExpress().CallbackPanel(
settings =>
{
settings.Name = "cbpDocWaiting";
settings.CallbackRouteValues = new { Controller = "DocumentsWaitingApproval", Action = "Refresh" };
控制器方法
[Authorize]
public ActionResult Refresh(DocumentsWaitingApprovalModel model) // model.SelectedDocument is always null
{
}
[Authorize]
public ActionResult Finalize([Bind]DocumentsWaitingApprovalModel model) //model.SelectedDocument is always null
{
return RedirectToAction("Index");
}
}