我正在开发一个解决方案,以便在完整日历jquery应用程序中输入项目拆分时间。SQL视图显示不完整的天数(输入的时间不等于8小时),并在Generate视图中呈现实体模型中的表:
@model IEnumerable<support_tickets.Models.DailyHours>
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Generate</title>
</head>
<body>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Start)
</th>
<th>
@Html.DisplayNameFor(model => model.Week)
</th>
<th>
@Html.DisplayNameFor(model => model.Hours)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Start)
</td>
<td>
@Html.DisplayFor(modelItem => item.Week)
</td>
<td>
@Html.DisplayFor(modelItem => item.Hours)
</td>
</tr>
}
</table>
</body>
</html>我希望在_Layout视图的页脚部分呈现相同的表,以查看一个页面上的所有内容。任何援助都是非常感谢的。谢谢
发布于 2022-02-04 18:25:25
这就是我所要做的--从PartialViewResult操作创建一个部分视图。
主计长:
public PartialViewResult IncompleteDays()
{
ticketsEntities entities = new ticketsEntities();
var ent = entities.DailyHours.ToList();
return PartialView(ent);
}使用该表从操作中创建一个部分视图:
@model IEnumerable<support_tickets.Models.DailyHours>
<div class="row justify-content-center">
<div class="col-auto">
<table class="table table-striped">
<tr>
<th>
@Html.DisplayNameFor(model => model.Start)
</th>
<th>
@Html.DisplayNameFor(model => model.Week)
</th>
<th>
@Html.DisplayNameFor(model => model.Hours)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Convert.ToDateTime(item.Start).ToString("MM-dd-yyyy")
</td>
<td>
@Html.DisplayFor(modelItem => item.Week)
</td>
<td>
@Html.DisplayFor(modelItem => item.Hours)
</td>
</tr>
}
</table>
</div>
</div>然后从_Layout视图的脚注部分调用操作:
@{ Html.RenderAction("IncompleteDays", "Home");}https://stackoverflow.com/questions/70962631
复制相似问题