Using ExtJS with ASP.NET, Webforms or MVC?
For a scenario using 0 ASP.NET controls at all but rather an 100% extJS interface, what w开发者_StackOverflowould be the advantages of using ASP.NET MVC or ASP.NET WebForms? And the disadvantages? Is there a OBVIOUS way to do it properly?
I would love to have feedback's on your experiences.
Thank you!
WebForms + any purely client-side framework will give you nothing but endless headaches, if you can get it working at all. Some of the issues I've had in the past (off the top of my head, it's been a while):
- WebForms limits you to a single
<form>
tag per page. While this does not necessarily prevent use of Ext or something like it, it is severely (and arbitrarily) limiting in many cases - WebForms is built around postbacks and viewstate. Assuming that you aren't using those features (since you have no server controls) you'll be fighting against the way WebForms wants to work. You can do this, but things really quickly turn hacky.
- WebForms has an entire page lifecycle and server-side event framework. Again, since you won't be using any of that, what's the point in picking WebForms?
- You're stuck with nasty urls unless you want to really fight with IIS.
ASP.Net MVC is a much better alternative if you still want to take advantage of what .NET can offer on the server side without the misery that is WebForms. There are also several different Ext.Direct providers for MVC available in the Ext forums if you search. Good luck finding anything out there to help you integrate Ext with WebForms (there is nothing).
EDIT: I've been using this implementation of the Ext.Direct stack for ASP.NET MVC for a while with excellent results.
Consider building your Ext JS front-end in isolation from the server.
This decoupling forces you to create a pure javascript application, and keeps you far away from the issues introduced by the "helpers" in various frameworks.
It reduces the amount of time you'll be "shifting gears" between server-side languages and javascript. In my experience, especially for developers new to Ext JS, the single biggest hurdle is in separating the front-end logic from the server-side logic.
And it will be blazing fast! Communicate with the server using pure HTTP and JSON and build an Ext JS application as it was intended!
For that I would tend to use the MVC style of ASP. Basically it is because ASP.net tends to add random junk you don't need. What you want is the purest cleanest thing to push data out to ExtJS. If you don't need any server interaction at all, say you're sending any entered back to Azure or S3, then you don't need any ASP at all you can sent static HTML.
ASP.Net MVC would be better for integrating with ExtJs. If you have to use Web Forms, then I would suggest to take a look at http://www.coolite.com/. This is a ASP.Net wrapper over ExtJs and will probably make life easier.
Another perspective: I am building a web client in extjs for a domain-specific .NET server remoting. I guess I could basically just push "raw" data to ext as the server app handles all logic, but as my remoting is not "web-aware", I am using a set of custom http handlers (.ashx) to parse parameters and set mime-types, session handling and all that web-server related stuff. With this architecture its working very well with just a few.ashx scripts, I dont feel any need to use a fancier setup like ASP.NET MVC (I dont even think that would fit), but I'm not using WebForms either.
精彩评论