0

在我看来,当用户单击“创建”按钮时,会更改一个局部视图。在我看来,我创建了多个局部视图然后在将数据保存在局部视图上之后,我想重新生成局部视图。

这是我的部分观点

@model LMS.Models.OrderTypeModels

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

 @{
      var defaulyDelivery = ViewBag.defaulyDelivery as IEnumerable<LMS.Models.t_COM_DELIVERY>;


            }


@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)



    <table>

     <tr><td>   @Html.LabelFor(model => model.Name)
    </td><td>
      @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
    </td></tr>

    <tr><td>  @Html.LabelFor(model => model.ddAddress)
    </td><td>
      @Html.DropDownListFor(model => model.ddAddress, ViewBag.defaulyDelivery as SelectList) 
    </td></tr>


        <tr><td>  @Html.LabelFor(model => model.Address)
    </td><td>
      @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
    </td></tr>

        <tr><td>  @Html.LabelFor(model => model.Active)
    </td><td>
    @Html.EditorFor(model => model.Active)
            @Html.ValidationMessageFor(model => model.Active)
    </td></tr>

    <tr><td colspan="2">

 <input type="button" value="Save Order Type"   onclick="location.href='@Url.Action("SaveOderType", "Business", new { ordertype = @Model })'"  />

    </td></tr>
    </table>




}

这是我的控制器

 public void SaveOderType(OrderTypeModels ordertypePeolpe)
        {

            ORDER_TYPE orderType = new ORDER_TYPE();
            //orderType.

            orderType.KEY = lastOrderTypeId + 1;
            orderType.BS_KEY = currentbskey;           
            db.AddToORDER_TYPE(orderType);
            db.SaveChanges();



        }

如果重定向到我的第一个控制器,所有其他部分视图都消失了。我该怎么做。

4

0 回答 0