Razor 遍历 DataTable

浪淘沙2年前后端477
@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 SqlSugar对SugarParameter 参数的调试

string sql = "select id,xm from stu where phone=@phone&...

JNTemplate 文章标签解析

using JinianNet.JNTemplate; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetC...

asp.net core webapi 调用furion 的webapi json接口

/// <summary> /// 根据学校读取支付科次 /// </summary> /// <returns>&l...

文件上传

@page @model xxtsoft.Pages.uploadModel @{    } <h1>@ViewData["Title...

JNTemplate 模板标签传递url参数

一、模板 private readonly SqlSugar.ISqlSugarClient _db;  public Index1M...

wangeditor编辑器

<!--编辑器--> <link href="/wangeditor/style.css" rel="stylesheet&quo...

发表评论    

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