How can we use web user controls in Asp.net MVC 4 the same way we use in ASP.net web forms application.
I didn't find any simple article on it yet
-
1Are you asking for a tutorial on web controls in asp.net MVC 4?Ryan Gates– Ryan Gates2013-08-28 13:02:47 +00:00Commented Aug 28, 2013 at 13:02
-
1You mean like a partial view?MikeSmithDev– MikeSmithDev2013-08-28 13:06:46 +00:00Commented Aug 28, 2013 at 13:06
-
If you want web forms, use web forms. MVC uses a different approach devoid of controls, viewstate and the page life cycle.asymptoticFault– asymptoticFault2013-08-28 13:19:39 +00:00Commented Aug 28, 2013 at 13:19
-
@Ryan Gates yes, but i don't know how to use partial view. In web form application, I used to render controls dynamically (for current user) in default.aspx. Is that possible in mvc 4. Also what is alternative for page_load method in mvc 4?Engineer M Sajjad– Engineer M Sajjad2013-08-28 13:30:05 +00:00Commented Aug 28, 2013 at 13:30
-
2Given the questions you are asking, you are not familiar with MVC paradigm, I highly recommend that you work through the tutorials available for MVC - asp.net/mvc/tutorials. We all have to start somewhere, and these are a great way to learn MVC architecture.Tommy– Tommy2013-08-28 13:39:41 +00:00Commented Aug 28, 2013 at 13:39
|
Show 1 more comment
1 Answer
In MVC - there are not any built in controls like you are used to seeing in WebForms (DataGrid, BreadCrumb, etc). These WebForm controls relied on concepts that do not exist in the MVC framework such as ViewState and PostBack. There have been many discussions around the use of WebForms vs MVC, web controls and lack thereof, but this is not the place for those.
You can build your own (using partial views for instance) or look at the third party components (Telerik).