如何在Mvc视图中查看Ascx页面 [英] How to View Ascx page in Mvc View

查看:91
本文介绍了如何在Mvc视图中查看Ascx页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个ascx页面.如何在我的Mvc视图中获取该页面.

i have created one ascx page.how to get that page my Mvc View

推荐答案

在ASP.NET中,我们过去经常使用ascx页面.在MVC框架中,它称为部分视图.您可以使用HTML标记在任何页面上呈现部分视图".

选项1:
In ASP.NET we used to have ascx pages quite a lot. In MVC framework it is called as Partial View. You can render the Partial View on any page using the HTML tags.

Option 1:
<![CDATA[<% Html.RenderPartial("~/Views/Shared/YourUserControl.ascx", {data model object}) %>]]>



选项2:



Option 2:

<![CDATA[<%= Html.RenderUserControl("~/Views/Shared/YourUserControl.ascx", {data model object}) %>]]>



有关更多信息,请参考 http://jeffreypalermo.com/blog/asp-net-mvc-and-the-templated-partial-view-death-to-ascx/ [



For more information you can refer to http://jeffreypalermo.com/blog/asp-net-mvc-and-the-templated-partial-view-death-to-ascx/[^]

Hope this helps.
All the best.


这篇关于如何在Mvc视图中查看Ascx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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