Co-exist of ASP.NET MVC and Web forms
MVC makes a web application's architect quite clear, however in my point of view, MVC is not a great for all solution.
One of MVC's pain points is handling the form submission. For a simple form submission, generally you need 2 action: ActionShowForm and ActionUpdateForm, the first action show a web form interface to let user edit the form, the second action is for submission. If you use server side form validation, it will be a little bit more complicated (depends on how you display those validation information to users).
Traditional ASP.Net web form can handle above form submission in very simple and straight forward way, with just one .aspx file and one code behind .cs file, complex web form handling is a easy and enjoyable work. It's also very easy and without too much code to use ASP.NET ajax's update panel to get fancy update free ajax form effect.
MVC frameworks has been used in Java web developing for a long time, look at what's Java's new movement? It's JSF(Java Server Face), something really like ASP.NET, it also have something similar to "view state" and "post back". What a interesting thing it is: after so many years working with MVC, Java guys are looking to web form alike "new" technology, and after using web forms for so many years, ASP guys are so exciting about MVC. :)
In one of my experiment project, I used ASP.NET MVC together with the web form. MVC is used as the major part of the web site, Web forms are used for all those form handling, they co-exist pretty well.
I create a folder named "forms", and put all web forms files (aspx and cs) inside this folder. Though it's ok to put them inside the "view" folder, I separated them because they are different in modeling. The web forms share the same "Model" part (if it require to access the "model"), I use session data object to pass data in/out the web forms.
Related posts:
- To "refresh" a SqlDataSource.
- asp:ControlParameter vs asp:FormParameter
- output a line in a batch *without* crlf
- Write code with no getters???
- Dump SQL Server Express' DB Schema
- My suggestions on Web2py's route design
- Good comparing of GAE Data Store .vs. Amazon Simple DB .vs. MS SSDS
- Very good articles on MVC, MVP and more.
- Presenter First approach in MVP
- ASP.NET MVC Preview 3 just released
Search related in web: