在MVC4中使用IEnumerable对象类型的视图 [英] view with IEnumerable of object type in MVC4
本文介绍了在MVC4中使用IEnumerable对象类型的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是MVC的新手.在使用MVC4应用程序时.我在视图中遇到以下错误(有关详细信息,请参见屏幕截图).我在控制器操作方法中有以下代码.
I am new to MVC. While working with MVC4 application. I am getting following errors in view(see screenshot for details). I have following code in controller action method.
public ActionResult ShowData()
{
IEnumerable<object> data = AccountMaster.GetAccountsInfo(); ;
return View(data);
}
在我看来
@Model IEnumerable<dynamic>
@{
ViewBag.Title = "ShowData";
WebGrid grid=new WebGrid(Model);
}
<h2>ShowData</h2>
如您所见,我正在查看此错误.有人可以帮我吗?
as you can see I am getting this error in view. Can somebody please help me with this?
推荐答案
小写@model
@model IEnumerable<dynamic>
我希望它能解决您的问题.
I hope it will solve your issue.
这篇关于在MVC4中使用IEnumerable对象类型的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文