Razor 遍历 DataTable

浪淘沙2年前后端436
@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>


返回列表

没有更早的文章了...

下一篇:给表加备注

相关文章

postgresql 迁移数据库,使用sql命令

pg_dump -d mydb -f mydb.sql psql -d mydb_new -f mydb.sql...

ckeditor编辑器

@page @model xxtsoft.Web.Entry.Pages.Index2Model @{ } <script src="~/ckeditor/...

导出excel

@page @model xxtsoft.Web.Entry.Pages.test2Model @{ } <form method="post"&...

asp.net core弹出对话框最佳实践

 public void OnGet()  {         ...

asp.net core 取得页面form中所有表单值

public IActionResult OnPostSubmit()         { &n...

DBeaver连接oracle 下载驱动报错

https://blog.csdn.net/weixin_45764765/article/details/124327194...

发表评论    

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