执行子请求时出错:' System.Web.Mvc.HttpHandlerUtil + ServerExecuteHttpHandlerAsyncWrapper'。添加验证消息后

时间:2017-01-16 20:42:25

标签: c# asp.net-mvc razor

我有这个错误并且清除了S.O.寻求答案。我使用[childonly],将控制器添加到我的渲染中。我能够提交但是一旦我添加了validationmessagefor。出现了这个例外。

Here's the partial View


<div class="panel panel-default">
    <div class="panel-heading">
        <h4 class="panel-title">
            <a data-toggle="collapse" data-parent="#accordion" href="#Draft">
                My Drafts
            </a>
        </h4>
    </div>
    <div id="Draft" class="panel-collapse collapse">
        <div class="panel-body">

            @{
                Html.RenderAction("GetDrafts","MyPostController");
            }

        </div>
    </div>
</div>
      <div class="row">
                <div class="col-md-5">
                    <label>Reply To:<small>(optional)</small></label>
                </div>
                <div class="col-md-7"> 
                    @Html.TextBoxFor(m => m.ReplyTo,null,new { @class = "form-control" })
                    @Html.ValidationMessageFor(m => m.ReplyTo)

                </div>


            </div>

除此之外还有

 @using (Html.BeginForm())
  {

   @Html.AntiForgeryToken()

 <div class="col-md-3">
    @*//side menu here*@
    @Html.Partial("_SideMenu", Model) 

</div>

这里是行动

    /// <summary>
    /// get all saved drafts
    /// </summary>
    /// <returns></returns>
    [ChildActionOnly]
    public ActionResult GetDrafts()
    {
        var drafts = _dbrepo.GetUserDrafts();
        return PartialView("_DraftView", drafts);
    }

here is the _draftview
@model IEnumerable<Models.MyModel>
@{
    Layout = null;
}

 <div class="table-responsive">
<small>

<table class="table">
    <tr>

        <th>
            @Html.DisplayNameFor(model => model.PostSubject)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.PostDate)
        </th>


        <th>
            @Html.DisplayNameFor(model => model.RecCreateUser)

        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.PostSubject)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.PostDate)
        </td>


        <td>
            @Html.DisplayFor(modelItem => item.RecCreateUser)
        </td>
        <td>
            @Html.ActionLink("View", "ViewDraft", new { id = item.ID}, new { @class = "btn btn-default btn-xs" }) 
        </td>


    </tr>
}

</table>
</small>
</div>

我试过这个Html.RenderAction Failed when Validation Failed 但它让我在以下行动方法中暧昧地模糊了#34;错误

正如我所提到的那样。如果modelstate无效,我能够发布数据。但一旦它无效。那个例外出现了。 我尝试评论渲染以进行测试。我能够抛出验证消息。

0 个答案:

没有答案