Click here to Skip to main content
11,500,106 members (59,075 online)
Click here to Skip to main content

Tagged as

Things you will miss in ASP.NET MVC as an ASP.NET Webform developer

, 20 Aug 2014 CPOL 17K 25
Rate this:
Please Sign up or sign in to vote.
Things you will miss in MVC as a Webform developer.

Introduction

No CodeBehind

No Server controls

No Page life cycle

No ViewState


Introduction

I have been a great fan of ASP.NET Webform development but for past 2 years ASP.NET MVC is the talk of the town. If you are new to MVC start here and if you want to learn MVC super-fast start here.

Note: - If ASP.NET MVC and ASP.NET WebForm vocabulary is confusing please read this before moving ahead :-

http://computerauthor.blogspot.in/2014/08/aspnet-vs-mvc-vocabulary-confusion_15.html .

When I started ASP.NET MVC development it took lot of time as an ASP.NET webform developer to get adjusted and acquainted with ASP.NET MVC development thought. This article walks you through some important mind set changes you need to make when working with ASP.NET MVC.

 

 

 

 

No CodeBehind

The whole thought of MVC is to get rid of behind code. Because behind code is not reusable , not testable .So when you add a view / UI in MVC is you will be find no behind code. You will find “.ASPX” but there is no “ASPX.CS”. You will find CSHTML but there is no CSHTML.CS.
 

Now the time we say “No Behind code” this has a cascading effect. The remaining points are the after effect of “No code behind” concept.

 

 
 
No Server controls

ASP.NET webform Server controls was always a life savior. It was like a magic where you drag and drop and you are done.Now because we do not have any behind code server controls will not be seen in your tool box. You have to use HTML to create your MVC UI. The maximum support officially you have currently is HTML Helper classes , you can read about it from here.

You can use server controls on an ASPX view but it’s not advisable as it will generate inline code behind again defeating the purpose of MVC.

No Page life cycle

Because we do not have behind code there is no such thing as page life cycle in ASP.NETMVC.In ASP.NET Webform the first hit comes to the Page and then rest of the things happen. ASP.NET Webform is UI first approach while MVC is class first approach.

In MVC the first hit comes to the controller class and then to the UI. So all the logic of page life cycle goes in the controller.So no more discussion on page life cycle and which event what code needs to be written.

No ViewState

There are no automated generated hidden fields like viewstate. We have more robust and fine tuned way of session management viewdata , tempdata ,viewbag and session variables. You can read more about them from clicking here.

Want to Learn MVC in 2 days start from this video






License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shivprasad koirala
Architect http://www.questpond.com
India India

I am a Microsoft MVP for ASP/ASP.NET and currently a CEO of a small
E-learning company in India. We are very much active in making training videos ,
writing books and corporate trainings. Do visit my site for 
.NET, C# , design pattern , WCF , Silverlight
, LINQ , ASP.NET , ADO.NET , Sharepoint , UML , SQL Server  training 
and Interview questions and answers


Comments and Discussions

 
GeneralLooks older days are back Pin
Gaurav.Kumar.Arora27-Oct-14 9:24
memberGaurav.Kumar.Arora27-Oct-14 9:24 
GeneralMy vote of 5 Pin
Sibeesh KV23-Sep-14 18:12
professionalSibeesh KV23-Sep-14 18:12 
QuestionGood Article Pin
Member 429919824-Aug-14 7:38
memberMember 429919824-Aug-14 7:38 
GeneralExcellent article! Pin
jlopez78820-Aug-14 3:46
memberjlopez78820-Aug-14 3:46 
SuggestionMissing reference link aspnet-vs-mvc-vocabulary-confusion Pin
Anjum.Rizwi20-Aug-14 2:21
memberAnjum.Rizwi20-Aug-14 2:21 
GeneralRe: Missing reference link aspnet-vs-mvc-vocabulary-confusion Pin
Shivprasad koirala20-Aug-14 2:30
mvpShivprasad koirala20-Aug-14 2:30 
QuestionFeatures Missing in MVC Pin
Nurudeen Alimi19-Aug-14 22:31
memberNurudeen Alimi19-Aug-14 22:31 
Bugnot 'behind code' Pin
thewazz19-Aug-14 8:25
memberthewazz19-Aug-14 8:25 
GeneralMy vote of 5 Pin
Carsten V2.017-Aug-14 21:28
memberCarsten V2.017-Aug-14 21:28 
GeneralRe: My vote of 5 Pin
Shivprasad koirala18-Aug-14 3:07
mvpShivprasad koirala18-Aug-14 3:07 
GeneralRe: My vote of 5 Pin
Carsten V2.018-Aug-14 4:00
memberCarsten V2.018-Aug-14 4:00 
GeneralRe: My vote of 5 Pin
Shivprasad koirala18-Aug-14 4:15
mvpShivprasad koirala18-Aug-14 4:15 
GeneralRe: My vote of 5 Pin
Sinisa Hajnal21-Sep-14 21:36
memberSinisa Hajnal21-Sep-14 21:36 
SuggestionMiss? I don't miss these web form features Pin
GuruBeBop17-Aug-14 10:51
memberGuruBeBop17-Aug-14 10:51 
GeneralRe: Miss? I don't miss these web form features Pin
Shivprasad koirala18-Aug-14 1:25
mvpShivprasad koirala18-Aug-14 1:25 
SuggestionRe: Miss? I don't miss these web form features Pin
Donny Redmond19-Aug-14 9:22
memberDonny Redmond19-Aug-14 9:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150520.1 | Last Updated 20 Aug 2014
Article Copyright 2014 by Shivprasad koirala
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid