public ActionResult TasksByProjectReport()
{
System.Data.DataTable data = _reportService.GetReportData();
return View(data);
}
@model System.Data.DataTable
@using System.Data; <h2>Report</h2>
<table>
<thead>
<tr>
@foreach (DataColumn col in Model.Columns)
{
<th>@col.ColumnName</th> }
</tr>
</thead>
<tbody>
@foreach (DataRow row in Model.Rows)
{
<tr>
@foreach (DataColumn col in Model.Columns)
{
<td>@row[col.ColumnName]</td> }
</tr> }
</tbody>
</table>
http://weblogs.asp.net/gunnarpeipman/archive/2011/11/19/asp-net-mvc-simple-view-to-display-contents-of-datatable.aspx
No comments:
Post a Comment