我的部分视图没有加载,我正在使用 AjaxActionLink 这是我的视图,我称之为部分视图
@foreach (var p in Model.Rooms)
{
<div class="room">
<h3>@p.RoomTitle</h3>
<img src="@p.PhotoRoom" alt="room"/>
<h4>@p.TitlePrice</h4>
<blockquote>@p.Description</blockquote>
@Ajax.ActionLink("Order room", "PartialDetail", new { @p.RoomID }, new AjaxOptions { UpdateTargetId = "results", LoadingElementId = "loading",HttpMethod = "POST",InsertionMode = InsertionMode.InsertAfter})
</div>
}
这是我的控制器
public PartialViewResult PartialDetail(int roomid)
{
Room rooms =
repository.Room.FirstOrDefault(p => p.RoomID == roomid);
var viewModel = new RoomEditViewModel
{
RoomID = rooms.RoomID,
RoomTitle = rooms.RoomTitle,
Description = rooms.Description,
PhotoRoom = rooms.PhotoRoom
};
ViewBag.room = roomid;
return PartialView(viewModel);
}