English 中文(简体)
Options for working with "old" asp.net user controls in a new razor-based MVC3 web app
原标题:

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)

最佳回答

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.

问题回答

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.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签