In ASP.NET MVC, do I use the "regular" controls from the toolbox and assign data to them like I did with webforms? Can I use the gridview, for example?
Thank you.
EDIT: The answer appears to be no. So what do you use? Are there any drag and drop controls in Visual Studio like the webform controls?
There is no viewstate and postback in ASP.NET MVC, so most of server controls will not work. There is set of MVC server controls in ASP.NET MVC RC that don't use postback nor viewstate and so they work fine.
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications.
ASP.NET is a 2 tier application in which no separate section for the database and MVC is a 3 tier application in which view and logic is kept separate. In ASP.NET for each . aspx form one URL is generated, but in MVC the url's are generated based on the controller and by the router configuration.
Angular JS Angular is the most-popular, most-used and most-discussed JavaScript Framework in context of web applications, and that too ASP.NET MVC applications.
For the most part, use of MVC is explicitly not a drag/drop affair. There isn't a level of auto-wiring data-bound controls either. The purpose within MVC's structure is to give more direct control over the markup. There are some helper methods that can be used with rendering Form controls. MVC is a very different development model server-side. NOTE, you can combine ASP.Net with MVC into a hybrid project.
I would suggest that you need to be very comfortable with HMTL markup, and how HTTP + HTML communication works in order to be successful with an MVC project. The use of javascript is also very explicit. MVC is very nice with regards to a separation of concerns from back end, and front end in web based applications. This makes it easier to design and test the back-end logic, in comparison to the front-end rendering. It is a framework for web developers (web based applications are the first concern), not a developer framework for a web front end (ASP.Net controls based).
ASP.Net MVC is focused around generating your own HTML using your View Templates. You can't use Webform controls in your Views and have the application handle them the same way as with Webforms. They might render properly, but there is no postback functionality or concept of maintaining their state.
That being said, you can integrate ASP.Net Webforms with your MVC style pages as well. You can always check out the classic Hanselman walkthrough of having a "hybrid" asp.net application: http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx
I believe you can use any control that does not rely on postback functionality.
The answer is Yes and No. Preferrably No.
This is what the community fears, an aggressive blending of asp.net and MVC into an unrecognizable and unecessarily complicated kludge.
For anyone looking at MVC, I'd suggest:
So to answer your question, MVC is still new, MVC Contrib, MVC Futures and Html helpers are avaiable in the framework and all over the web. Keep surfing and keep your own library of tweaks then post them so others can find and improve on them and vice versa. MVC can be the change the .net community has been waiting for, let's not go back to drag and drop so quickly.
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With