Razor 遍历 DataTable

浪淘沙2年前后端528
@using System.Data

<table class="table table-bordered table-striped table-hover">
    <thead>
        <tr>
            @foreach (System.Data.DataColumn column in Model.dt.Columns)
            {
                <th>@column.ColumnName</th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (System.Data.DataRow row in Model.dt.Rows)
        {
            <tr>
                @foreach (var cell in row.ItemArray)
                {
                    <td>@cell.ToString()</td>
                }
            </tr>
        }
    </tbody>
</table>


返回列表

没有更早的文章了...

下一篇:给表加备注

相关文章

asp.net core 获取当前url

  site = $"{Request.Scheme}://{Request.Host}";...

asp.net core多按钮提交实现

<form method="post">     <button type="submit...

设置edge浏览器自动填充 input password值

<form autocomplete="off">    <input type="password" name=&quo...

_LayoutAdmin.cshtml 取得url,调用ViewComponent 视图

_LayoutAdmin.cshtml 取得url,调用ViewComponent 视图

<body id="watermark-parent"> @{ var name = Furion.App.HttpC...

asp.net core sqlsugar timestamp 防sql注入方法

 string sql= "insert into ts (title,dx,zt,tsnr,tpe,jhsj,bz,guid)&...

asp.net core [BindProperty] 用法

在 ASP.NET Core 中,[BindProperty] 是一种用于绑定模型属性的特性,通常与 Razor 页面配合使用。它会自动将请求中的表单数据绑定到页面模型的属性上,简化了手动从 Requ...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。