数据未显示 [英] Data is not displaying

查看:56
本文介绍了数据未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,

我刚刚开始使用MVC框架.
我有一个网格视图.我正在将枚举对象传递给它
问题-为什么页面加载后数据不显示.

我的代码是

Hi friends,

I have just started to the MVC framework.
I have a grid view.i am passing the enum object to it
Problem--Why the data is not displaying when the page get''s loaded.

My code is

<table border="1">
        <tr>
            <td>
                Projected Revenues
            </td>
            <td>
                Years
            </td>
            <td>
                Amount
            </td>
        </tr>
        <tr>
            <td>
   <%  var grid = new WebGrid(source: (IEnumerable<dynamic>)ViewData["Test"],
                      rowsPerPage: 10,
                      selectionFieldName: "SelectedRow",
                      ajaxUpdateContainerId: "grid");
                grid.Pager(WebGridPagerModes.FirstLast);
                grid.GetHtml(tableStyle: "webGrid",
                htmlAttributes: new { id = "grid" },
                headerStyle: "header",
                footerStyle: "footer",
                alternatingRowStyle: "alt",
                columns: grid.Columns(
                grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { first_name = item.first_name, last_name = item.last_name })),
                grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { first_name = item.first_name, last_name = item.last_name })),
                grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { first_name = item.first_name, last_name = item.last_name }))));
                grid.GetHtml();
                %>
          
            </td>
        </tr>
    </table>
    <% }%>



为了测试,我在lambda表达式上加上了姓氏
请帮助我我做错了什么


谢谢



Just for the test i have put the last name on the lambda expression
Please help me what wrong i am doing


Thanks

推荐答案

您有WebMatrix吗? MVC3中没有网格.大多数MVC代码只是发出表本身,这就是我一直这样做的方式.另外,您应该使用Razor语法.不要使用<%语法.如果您查看源代码,我想知道您的网格"是不是只是因为它的一个长标签而被发出而不呈现?
Do you have WebMatrix ? MVC3 does not have a grid in it. Most MVC code just emits the table itself, that''s how I always do it. Also, you should use Razor syntax. Don''t use the <% syntax. If you view source, I wonder if your ''grid'' is just being emitted and not rendered because it''s one long tag ?


这篇关于数据未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆