0

我有具有 CompanyTable 部分视图的视图。所以这个局部视图有一个 CreateBankAccount 局部视图。最后的部分视图代码是

@model Invoice.Model.BankAccount

<script src="~/Scripts/jquery-1.7.1.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>



<a href="#@Model.TaxID" role="button" class="btn" data-toggle="modal">Launch demo modal</a>
<div id="@Model.TaxID" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">Modal header</h3>
    </div>
    <div class="modal-body">
        @using (Ajax.BeginForm("CreateModal", "CompanyController", new AjaxOptions { UpdateTargetId = "modal", HttpMethod = "post" }))
        {
            @Html.ValidationSummary(true)

            <fieldset>
                <legend>BankAccount</legend>

                @Html.HiddenFor(model => model.ID)

                <div class="editor-label">
                    @Html.LabelFor(model => model.BankName)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.BankName)
                    @Html.ValidationMessageFor(model => model.BankName)
                </div>

                <div class="editor-label">
                    @Html.LabelFor(model => model.CorrespondentAccount)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.CorrespondentAccount)
                    @Html.ValidationMessageFor(model => model.CorrespondentAccount)
                </div>                   
                <input type="submit" value="save" />
            </fieldset>
        }
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <input type="submit" class="btn btn-primary" value=" Save changes" data-dismiss="modal" />
    </div>
</div>

所以这个局部视图是模态弹出窗口。我的问题是,当我想创建 bankAccount 时,我的 HttpPost 方法不起作用,并且我返回 Index 操作。我该如何解决?

4

0 回答 0