MVC 前台获取后台数据的简单方法

后台代码:

前台代码:

然后在前台循环取出数据 放到页面上:

<table>
        <thead id="">
                    <tr id="" class="">
                        <th class="">真实姓名</th>
                        <th class="">用户名</th>
                        <th class="">用户身份</th>
                        <th class="">添加时间</th>
                    </tr>
        </thead>
        <tbody>
            @foreach (System.Data.DataRow dr in Model.Rows)
                    {
                        <tr>
                            <td class=""><span>@dr["trueName"]</span></td>
                            <td class=""><span>@dr["loginName"]</span></td>
                            <td class=""><span>@dr["roleName"]</span></td>
                            <td class=""><span>@dr["addTime"]</span></td>
                        </tr>
                    }
        </tbody>
   
</table>

猜你喜欢

转载自blog.csdn.net/love_pgme/article/details/81587760