【发布时间】:2019-06-28 08:48:10
【问题描述】:
我有一个不适合页面的表格,他们是一种调整表格大小甚至重新格式化表格的方法,以便条目可以在另一个下方继续,因为将条目分成两行?或任何其他我可以将所有数据显示在表格内的解决方案。
<table class="table table-bordered table-sm">
<tr>
<th>
Name
</th>
<th>
EmployeeNo.
</th>
<th>
HoursTaken
</th>
<th>
Site
</th>
<th>
Shift
</th>
<th>
AL Start Date
</th>
<th>
AL Finish Date
</th>
<th>
Hours Requested
</th>
<th>
Comments
</th>
<th>
Year of Holiday
</th>
<th>
Status
</th>
<th>
Submitted by
</th>
<th>
Approved by
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Employee.FullName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Employee.EmployeeID)
</td>
<td>
@Html.DisplayFor(modelItem => item.Employee.HoursTaken)
</td>
<td>
@Html.DisplayFor(modelItem => item.Employee.Site.SiteName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Employee.Shift.Shift1)
</td>
<td>
@Html.DisplayFor(modelItem => item.StartDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.FinishDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.HoursTaken)
</td>
<td>
@Html.DisplayWithBreaksFor(modelItem => item.Comments)
</td>
<td>
@Html.DisplayFor(modelItem => item.YearOfHoliday)
</td>
<td>
@Html.DisplayFor(modelItem => item.Approved)
</td>
<td>
@Html.DisplayFor(modelItem => item.SubmittedBy)
</td>
<td>
@Html.DisplayFor(modelItem => item.ApprovedBy)
</td>
<td>
@Html.ActionLink("Approve/Reject", "Edit", new { id = item.RequestID }, new { @class = "btn-xs btn-success glyphicon glyphicon-thumbs-up" })<b> ᛫</b>
@Html.ActionLink("Details", "Details", new { id = item.RequestID }, new { @class = "btn-xs btn-info glyphicon glyphicon-info-sign" })<b> ᛫</b>
@Html.ActionLink("Delete", "Delete", new { id = item.RequestID }, new { @class = "btn-xs btn-danger glyphicon glyphicon-trash" })
</td>
</tr>
}
</table>
我想要它,以便表格适合页面。
【问题讨论】:
-
这个问题本质上就是为什么现在网格系统比表格更受欢迎。表格不容易做出响应。对于一个简单的开箱即用解决方案,我建议您查看Bootstrap grid system
-
@Liam 抱歉,那是意外
-
嗨@Conor8630,您的问题与ASP NET MVC 无关,因此我建议您将标题更改为“引导表不适合”之类的内容,以避免人们对您的问题投反对票。谢谢
-
@TiagoBrenck 感谢您的提醒
-
@Conor8630 你试过我的答案了吗?
标签: html asp.net-mvc html-table responsive-design