我正在尝试开发一个模型表单并在其中插入我的视图,就像这样。
但是Entity FrameWork带有菜单和页脚的所有视图,就像这样。
如何删除菜单和页脚视图,并且只包含字段和标签?
@model TPTMVC.Models.User
@using TPTMVC.Models;
@{
ViewBag.Title = "Details";
}
<h2>Details</h2>
@using (@Html.BeginForm())
{
<fieldset>
<legend>User</legend>
<div class="display-label">FirstName</div>
<div class="display-field">@Model.FirstName</div>
<div class="display-label">LastName</div>
<div class="display-field">@Model.LastName</div>
<div class="display-label">Number</div>
<div class="display-field">@((Model.billingDetail).Number)</div>
<div class="display-label">Owner</div>
<div class="display-field">@((Model.billingDetail).Owner)</div>
</fieldset>
}
public ViewResult Details(int id)
{
User user = context.User.Single(x => x.UserId == id);
return View(user);
}
链接
@Html.ActionLink("Details", "Details", new { id = item.UserId }, new { @class = "Details" })
Jquery的
$(".Details").live(
"click", function (e) {
// e.preventDefault(); use this or return false
var url = $(this).attr('href');
$("#dialog-view").dialog({
title: 'Detail User',
autoOpen: false,
resizable: false,
height: 250,
width: 400,
show: {
effect: 'drop',
direction: "up"
},
modal: true,
draggable: true,
open: function (event, ui) {
$(this).load(url);
},
buttons: {
"Close": function () {
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).dialog('close');
}
});
$("#dialog-view").dialog('open');
return false;
e.preventDefault();
});
我在实体框架中发展。
感谢您的帮助!
答案 0 :(得分:0)
返回PartialView
而不是View
public PartialViewResult Details(int id)
{
User user = context.User.Single(x => x.UserId == id);
return PartialView("Details", user);
}