回发后MVC标签页没有刷新嵌套的局部视图

时间:2015-01-13 22:19:29

标签: javascript asp.net-mvc asp.net-mvc-3 jquery-ui asp.net-mvc-4

我正在使用jquery tab ui。我的第二个标签在发布时包含此表单,不刷新我嵌套的部分视图。可能是什么问题?

_Partial_Item_Tab.cshtml

@model Mvc5.Models.ORDER_DETAILSMetadata

@{
    var ordernumber = (int)Session["Order_Number"];   
}
    @using (Ajax.BeginForm("Items", "Order",
            new AjaxOptions
            {
                HttpMethod = "POST",
                InsertionMode = InsertionMode.Replace,
                UpdateTargetId = "target"
            }))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true)

        @Html.TextBoxFor(model => model.id)                           
        <input type="submit" value="Add" class="btn btn-default" />

    }

<div id="target">
    @Html.Action("Items_List", new { id = ordernumber });    <==== This does not show up after postback.  Only after clicking browser refresh button does it show.
</div>

项目控制器(HttpPOST)

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Items(ORDER_DETAILSMetadata model)
{


        // check to see if exists

        //update order 
        Order order = new Order();
        ....
        return PartialView("_Partial_Item_Tab", order);                


}

Item_List控制器

    public ActionResult Items_List(int id)
    {

        List<ORDER_DETAILS> result = db.ORDER_DETAILS.Where(p => p.Order_Number == id).ToList();

        return PartialView("_Partial_Items_List", result);

    }

0 个答案:

没有答案