Asp.Net MVC2错误鉴于 [英] Asp.Net MVC2 Error in view

查看:96
本文介绍了Asp.Net MVC2错误鉴于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的MVC,我一直在关注史蒂芬安德森临ASP.Net MVC 2框架的书,但也遇到了以下问题。

I am new to MVC and I have been following Steven Andersons Pro ASP.Net Mvc 2 framework book but have encountered the following issue.

code的下面一行,在我的Site.Master文件坐镇引发以下错误:

The following line of code that sits in my site.Master file throws the following error:

<% Html.RenderAction("Menu", "Nav"); %>

{执行的处理程序System.Web.Mvc.HttpHandlerUtil + ServerExecuteHttpHandlerAsyncWrapper'子请求错误}

{"Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'."}

这个问题似乎是我的部分观点,即试图使上述code的结果中。

The problem seems to be within my Partial View that is trying to render the result of the above code.

这是放出来在浏览器中的实际错误如下:

The actual error that is out put in the browser is as follows:

未能加载类型
System.Web.Mvc.ViewUserControl&LT;&IEnumerable的LT; WebUI.Models.NavLink&GT;方式&gt;

我的部分观点包括以下内容:

my partial view consists of the following:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<WebUI.Models.NavLink>>" %>
<%foreach (var link in Model) { %>
<%: Html.RouteLink(link.Text, link.RouteValues }%>

也似乎有没有可用于为Model智能感知。

There also seems to be no IntelliSense available for for the Model.

我知道它是与继承,但我已经检查了命名空间,这似乎是正确的。

I know it has something to do with the Inheritance but I have checked the namespace and this appears to be correct.

任何帮助将是非常美联社preciated。

Any help on this would be much appreciated.

在此先感谢

推荐答案

我正在通过桑德森的书和有同样的问题。解决的办法是,虽然从菜单继承NavLinks该文件名为NavLink.cs。更正链路或重命名文件,一切工作。

I'm working through Sanderson's book and had the same problem. The solution is that the file is named NavLink.cs while the menu inherits from NavLinks. Correct the link or rename the file and everything works.

这引出一个问题很有意思的问题:你是如何从错误信息,这是一个命名空间的问题确定?
伯爵湾

Interesting problem that begs one question: How did you determine from the error message that this was a namespace issue? Earl B.

这篇关于Asp.Net MVC2错误鉴于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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