标签:
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">
标签:
原文地址:http://www.cnblogs.com/Percy_Lee/p/5396861.html