mvc的视图中显示DataTable的方法

mvc的视图中显示DataTable的方法:

不断的循环画出table

@{
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">
上一篇:js中的DOM事件与对象


下一篇:oradmin相关用法