Displaying standard DataTables in MVC

后端 未结 3 1025
别跟我提以往
别跟我提以往 2020-11-27 03:29

Perhaps this is just completely wrong, but back in the days of Webforms you would return a Dataset which you would then bind to a grid. But now in MVC you\'re not supposed

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 03:42

    Here is the answer in Razor syntax

     
              @foreach (System.Data.DataColumn col in Model.Columns)
              {
                 
              }
           
        @foreach(System.Data.DataRow row in Model.Rows)
        {
           
              @foreach (var cell in row.ItemArray)
              {
                 
              }
           
        }      
        
    @col.Caption
    @cell.ToString()

提交回复
热议问题