2011-04-11 72 views
2

我从那里“用户”存在主视点调用的RenderPartial上:的RenderPartial呈现上开发,但未能生产服务器

@{Html.RenderPartial("DisplayTemplates/uInfo", user);} 

作品在我的dev的机器,但在生产服务器被折腾的是运行时错误的:

未找到部分视图'DisplayTemplates/uInfo'或没有视图引擎支持搜索的位置。以下地点搜索:...

以下地点查询:上市

~/Views/Account/DisplayTemplates/uInfo.aspx 
~/Views/Account/DisplayTemplates/uInfo.ascx 
~/Views/Shared/DisplayTemplates/uInfo.aspx 
~/Views/Shared/DisplayTemplates/uInfo.ascx 
~/Views/Account/DisplayTemplates/uInfo.cshtml 
~/Views/Account/DisplayTemplates/uInfo.vbhtml 
~/Views/Shared/DisplayTemplates/uInfo.cshtml 
~/Views/Shared/DisplayTemplates/uInfo.vbhtml 

我的文件_is - 共享/ DisplayTemplates/uInfo.cshtml和本地工作。

万一它是相关的 - 我正在采取在剃刀和遗留.aspx视图之间来回自由切换的自由。最初担心混合两种可能的复杂因素,但到目前为止,我尝试过的所有方法都能奏效。

THX

回答

0

它不应该是:

@Html.DisplayFor(model => model.User) 

而如果model.User类型为uInfo,MVC将在DisplayTemplates文件夹默认外观和找到uInfo.cshtml。这是工作中的MVC大会。

您不应该使用RenderPartial呈现显示模板。

如果你想有一个局部视图,这样做:

@Html.Partial("SomePartial", user)

不过,我同意你的行为看到的是奇怪的,这真的doensn't答案问题 - 但尝试和坚持MVC约定首先。

+0

我已经继承了代码,并且无法跟踪开发该代码的dev的通过进程(或技能级别)。该调用已在应用中的其他地方工作(旋转和呈现)。我暂时砍死了它 - 当我有时间时想重新访问它。谢谢! – justSteve 2011-04-13 01:12:08

相关问题