How can I pass datatable to the mvc view
How would I iterate over it in the view
How can I pass datatable to the mvc view
How would I iterate over it in the view
In your controller:
public ActionResult Index()
{
DataTable dt = new DataTable();
return View(dt);
}
In your View: Just make your model of type DataTable
Inherits="System.Web.Mvc.ViewPage<System.Data.DataTable>"
To iterate over it:
<% foreach (System.Data.DataRow row in Model.Rows) { %>
<%= row["column"].ToString(); %>
<%}%>