使用“旧”选项基于 razor 的新 MVC3 Web 应用程序中的 asp.net 用户控件
我即将开始开发新的 mvc3 razor Web 应用程序。我想在此应用程序中使用 Ext.Net,但 ext.net 使用一组已编译的用户控件进行工作基本上封装了 ExtJs UI 套件。
您可以下载一个 ext.net mvc 示例,它使用 MVC2 和默认的 asp.net 视图引擎,它不太令人愉快,因为它看起来非常像视图内的 old-skool webforms 代码,但它可以工作:
Inside a view/ master:
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
...
<ext:ViewPort ID="ViewPort1" runat="server" Layout="border">
<Items>
<ext:Panel ID="Panel1"
runat="server"
...
理想情况下,我想在我的新应用程序中使用 MVC3,并且我非常热衷于迁移到 razor。但显然,这是行不通的,因为我在视图中渲染用户控件。
我不知道 ext.net 人员是否/何时会将产品移植到 mvc 视图引擎,但与此同时,是否有一个解决方案.解决方法可以用来实现相同的目标? (我不想直接使用 ExtJS - 我希望加快交付速度,而 ext.net 似乎更容易)
I'm about to start work on a new mvc3 razor web application. I'd like to use Ext.Net in this application, but ext.net works using a set of compiled user controls that basically wrap the ExtJs UI suite.
There is an ext.net mvc example you can download that uses MVC2 with the default asp.net view engine, it's not pleasant in that it looks very much like old-skool webforms code inside the view, but it works:
Inside a view/master:
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
...
<ext:ViewPort ID="ViewPort1" runat="server" Layout="border">
<Items>
<ext:Panel ID="Panel1"
runat="server"
...
Ideally, I want to use MVC3 for my new application, and I'm very keen to move to razor. But obviously, this isn't going to work since I'm rendering user controls in the view.
I don't know if/when the ext.net guys will port the product for mvc view engines, but in the meantime is there a solution.workaround that I could use to achieve the same thing? (I'd rather not use use ExtJS directly - I'm looking to expedite delivery and ext.net seems much easier)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前 Ext.NET 无法与 Razor 一起使用,尽管它在默认的 MVC 视图引擎中可以完美运行。
巧合的是,此时此刻,Ext.NET 的下一个版本正在开发中,它将完全支持所有 MVC 视图引擎。我知道这现在对您没有帮助,但可能对未来的项目感兴趣。
@jfar - Ext.NET 不依赖于 ViewState,并将在 ASP.NET MVC 视图中呈现。
Currently Ext.NET will not work with Razor, although it will function perfectly fine within the default MVC viewengine.
Coincidently, right at this moment, the next release of Ext.NET is being worked on, and it will fully support all MVC view engines. I know that does not help you right now, but might be of interest for a future project.
@jfar - Ext.NET does not depend/rely on ViewState and will render within ASP.NET MVC views.
如果不进行大量重构,您根本无法获取依赖于 ViewState 的控件并使它们与 MVC 一起使用。
一种选择是制作非 MVC 页面并将它们包含在您的应用程序中。 WebForms 和 MVC 可以很好地协同工作。
You simply cannot take controls that depend on ViewState and make them work with MVC without extensive refactoring.
One option is to make non-MVC pages and include them in your app. WebForms and MVC can play nicely together.