MVC显示DATATABLE

@{
ViewBag.Title = "ShowDataTable";
}
@using System.Data;
@model Models.ConModel

@{
var table = Model.ExcelTable as DataTable;
}

<script src="~/Scripts/My97DatePicker/WdatePicker.js"></script>
<table border=1 cellspacing=0 cellpadding=2>
<thead>
<tr>
@foreach (DataColumn dc in table.Columns)
{
<th>
@dc.ColumnName
</th>
}
</tr>
<tbody>
@foreach (DataRow dr in table.Rows)
{
<tr>

@foreach (DataColumn d in table.Columns)
{
<td>
@dr[d.ColumnName]
</td>
}

</tr>
}
</tbody>
</thead>
</table>

 

<script type="text/javascript">

@{
ViewBag.Title = "ShowDataTable";
}
@using System.Data;
@model Models.ConModel

@{
var table = Model.ExcelTable as DataTable;
}

<script src="~/Scripts/My97DatePicker/WdatePicker.js"></script>
<table border=1 cellspacing=0 cellpadding=2>
<thead>
<tr>
@foreach (DataColumn dc in table.Columns)
{
<th>
@dc.ColumnName
</th>
}
</tr>
<tbody>
@foreach (DataRow dr in table.Rows)
{
<tr>

@foreach (DataColumn d in table.Columns)
{
<td>
@dr[d.ColumnName]
</td>
}

</tr>
}
</tbody>
</thead>
</table>

 

<script type="text/javascript">

posted @ 2022-10-07 08:04  厦门哈韩  阅读(76)  评论(0编辑  收藏  举报