Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does ASP.NET MVC use the regular toolbox controls?

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?

like image 811
johnny Avatar asked May 21 '09 18:05

johnny


People also ask

Can we use ASP.NET controls in MVC?

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.

What are the 3 main components of an ASP.NET MVC application?

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.

What is the difference between ASP and MVC?

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.

Which framework is best for ASP.NET MVC?

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.


4 Answers

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).

like image 114
Tracker1 Avatar answered Oct 03 '22 09:10

Tracker1


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

like image 22
womp Avatar answered Oct 03 '22 09:10

womp


I believe you can use any control that does not rely on postback functionality.

like image 37
Derek Ekins Avatar answered Oct 01 '22 09:10

Derek Ekins


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:

  • Appreciate clean simple HTML. Empty out your toolbox :-)
  • Surf and learn how to code controls to be generated the way you need them to. Strongly typed, powerful html generators will come but I'd prefer them to be clean and not wrapped in a control, I want to see the code.
  • try not to mix asp.net and mvc ( tempting ) but unless you're forced to, consider it a no-no

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!

like image 40
5x1llz Avatar answered Oct 01 '22 09:10

5x1llz