0

我在表单内使用回调面板,当 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");
        }
    }
4

0 回答 0