看不到WebGrid元素 [英] Can't see WebGrid element

查看:118
本文介绍了看不到WebGrid元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用帮助器WebGrid(MVC 4)构建一个表。我尝试这样做,如下所示,但错误无法找到名称空间WebGrid类型的名称,尽管在代码中包含名称空间System.Web.Heplers。 IDE还强调WebGrid这个词不合适。



我明白有一些小错误,但我很困惑。请帮助我。



 @ model IEnumerable< MvcApplication_test.Models.Customer> 
@using System.Web.Helpers;

@ {
布局= null ;
ViewBag.Title = 索引;
var grid = new WebGrid(Model,rowsPerPage: 5 );
}

解决方案

您是否包含GetHtml方法?

 @ {
布局= null ;
ViewBag.Title = 索引;
var grid = new WebGrid(Model,rowsPerPage: 5 );
}
@ grid.GetHtml();



请参考这篇文章: ASP.NET MVC4中的WebGrid [ ^ ]

除了上面的检查,下面的答案可能会有所帮助

如何在cshtml视图中使用WebGrid? [< a href =http://stackoverflow.com/questions/11042556/how-to-use-webgrid-in-a-cshtml-viewtarget =_ blanktitle =New Window> ^ ]


I'd like to build a table with the helper WebGrid (MVC 4). I try to do it as shown below, but an error Failed to find name of type of namespace "WebGrid" occurres, in spite of included namespace System.Web.Heplers in the code. Also IDE underlines the word "WebGrid" as something not proper.

I understand that there is some small mistake, but I'm confused with. Please, help me.

@model IEnumerable<MvcApplication_test.Models.Customer>
@using System.Web.Helpers;

@{
    Layout = null;
    ViewBag.Title = "Index";
    var grid = new WebGrid(Model, rowsPerPage: 5);
}

解决方案

have you include GetHtml method?

@{
    Layout = null;
    ViewBag.Title = "Index";
    var grid = new WebGrid(Model, rowsPerPage: 5);
}
@grid.GetHtml();


please refer this article : WebGrid in ASP.NET MVC4[^]
in addition to above check below answers which may be helpfull
How to use WebGrid in a cshtml view?[^]


这篇关于看不到WebGrid元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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