PartialView中的水平表格HTML

问题描述

我正在使用Asp.Net Core MVC进行Web应用程序项目,其中有一个显示水平表的视图。我正在使用部分视图来实现这一点,但我坚持如何代表固定的五行,如下所示:

  1. 日期
  2. 适当
  3. 不合适
  4. NoInteraction

每行将动态打印这些值。

这是“我的视图”,它可以按预期传递所有内容。

<form method="get" asp-action="details">
    <table class="table order-list">
        <thead>

            @for (int i = 0; i < Model.SessionList.Count; i++)
            {
        <partial name="_ChartDetailsPartial" for="@Model.SessionList[i]"

                 />}

        </thead>
    </table>
    </form>

这是我的partialView,我要在其中显示和排列所有内容。

@model TestApplication.Models.ViewModels.SessionViewModel

@{
    ViewData["Title"] = "_ChartDetailsPartial";
}

<input type="hidden" asp-for="Id" />

<tr>
    <th>Day</th>
    @for (int i = 0; i < 16; i++)
    {
        <td>@Html.DisplayFor(m => m.Day)</td>
    }
</tr>
<tr>
    <th width="200">Date</th>
    @for (int i = 0; i < 16; i++)
    {
        <td>@Html.DisplayFor(m => m.Date)</td>
    }
</tr>
<tr>
    <th style="text-decoration: underline limegreen">Appropriate Data</th>
    @for (int i = 0; i < 16; i++)
    {
<td>@Html.DisplayFor(m => m.Appropriate)</td>
    }
</tr>
<tr>
    <th style="text-decoration: underline red">InAppropriate Data</th>
    @for (int i = 0; i < 16; i++)
    {
        <td>@Html.DisplayFor(m => m.NotAppropriate)</td>
    }
</tr>
<tr>
    <th style="text-decoration: underline darkgray">No Interaction Data</th>
    @for (int i = 0; i < 16; i++)
    {
<td>@Html.DisplayFor(m => m.NoInteraction)</td>
    }
</tr>

我要实现的目标与下图相似:

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)