从渲染不同的文件夹部分(不共享) [英] Render partial from different folder (not shared)

查看:100
本文介绍了从渲染不同的文件夹部分(不共享)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能有一个观点呈现来自不同的文件夹的部分(用户控件)?
随着preVIEW 3我习惯叫RenderUserControl的完整路径,但蒙山升级到preVIEW 5这是不可能的了。
相反,我们得到的RenderPartial方法,但它不是我提供我正在寻找的功能。

How can I have a view render a partial (user control) from a different folder? With preview 3 I used to call RenderUserControl with the complete path, but whith upgrading to preview 5 this is not possible anymore. Instead we got the RenderPartial method, but it's not offering me the functionality I'm looking for.

推荐答案

就包括路径视图,文件扩展名。

Just include the path to the view, with the file extension.

剃刀:

@Html.Partial("~/Views/AnotherFolder/Messages.cshtml", ViewData.Model.Successes)

ASP.NET引擎:

ASP.NET engine:

<% Html.RenderPartial("~/Views/AnotherFolder/Messages.ascx", ViewData.Model.Successes); %>

如果这不是你的问题,请您提供您code,它用来与RenderUserControl工作?

If that isn't your issue, could you please include your code that used to work with the RenderUserControl?

这篇关于从渲染不同的文件夹部分(不共享)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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