MVC---- DataSet 页面遍历

后台代码:

  public override ActionResult Index()
  {
         DataSet ab = custapp.GetCustomerFollows();
         ViewData["activityDs"] = ab;
         return View();
  }

前台代码:

@using System.Data

   $(function () {
        jQuery.ajax({
            url: "/Business/CustomerFollow/GetList",
            data: null,
            dataType: "json",
            async: false,
            btn: null
        });
  }

 @{ foreach (DataRow activities in ((DataSet)ViewData["activityDs"]).Tables[0].Rows)
     {
        <table class="ui-jqgrid-btable ui-common-table table table-bordered" style=" background:#ffffff!important; margin-bottom:30px;">
            <tbody>
                <tr class="jqgfirstrow">
                    <td style="height:50px;line-height:50px;">@activities["F_Id"]</td>
                    <td style="height:50px;line-height:50px;">@activities["F_FullName"]</td>
                    <td style="height:50px;line-height:50px;">@activities["F_Msisdn"]</td>
                    <td style="height:50px;line-height:50px;">@activities["F_CreatorTime"]</td>
                    <td style="height:50px;line-height:50px;">@activities["F_CreatorUserName"]</td>
                </tr>
                <tr>
                    <td colspan="5">
                        <textarea id="@activities["F_Id"]" class="ckeditor" id="postContent" ></textarea>
                    </td>
                </tr>
            </tbody>
        </table>
     }}
原文地址:https://www.cnblogs.com/youmingkuang/p/7234531.html