Introduction
Design patterns are very useful to solve complex design problems if used properly. This article explains the basic concept of the Model View Controller (MVC) Design pattern and also shows how closely .NET Framework can be used to implement the MVC design pattern with the one that originally conceived.
Prerequisites
Object Oriented-programming concepts, .NET Framework, ADO.NET, C#, XSD.
Definition/Description: Model View Controller (MVC)
View renders the data from the Model in response to the request made to the model by controlled events made by user interaction.
Model View Controller is a design approach to separate the application object model from GUI, originally invented around 80s. Then later on it has become a widely accepted common design pattern. The main objective behind this pattern is to decouple the view of the data (presentation layer) from the actual data processing so that the same model can be used for various views. This is achieved by using three different types of objects that interact with each other in loosely coupled manner with their discreet set of tasks.
These three objects are known as Model, View and Controller. We will learn for each of them here.

View
View is the graphical data presentation (outputting) irrespective of the real data processing. View is the responsible for look and feel, some custom formatting, sorting etc. View is completely isolated from actual complex data operations. For example, Online product catalog view is completely separated from database connection, query, tables etc. It simply gets final row-data from the model and puts some cosmetics and formatting before displaying it in browser. View provides interface to interact with the system. The beauty of MVC approach is that it supports any kind of view, which is challenging in todays distributed and multi-platform environment.
A MVC model can have multiple views, which are controlled by controller. View interface can be of WEB-FORMS, HTML, XML/XSLT, XTML, and WML or can be Windows forms etc.
Model
Model is responsible for actual data processing, like database connection, querying database, implementing business rules etc. It feeds data to the view without worrying about the actual formatting and look and feel. Data provided by Model is display-neutral so it can be interfaced with as many views without code redundancy; this eases your code maintenance and reduces bugs and allows code -reuse at good extent. Model responds to the request made by controllers and notifies the registered views to update their display with new data.
Controller
Controller is responsible for Notice of action. Controller responds to the mouse or keyboard input to command model and view to change. Controllers are associated with views. User interaction triggers the events to change the model, which in turn calls some methods of model to update its state to notify other registered views to refresh their display.
Benefits
Following are the few of the benefits of MVC design pattern.
Since MVC handles the multiple views using the same enterprise model it is easier to maintain, test and upgrade the multiple system.
It will be easier to add new clients just by adding their views and controllers.
Since the Model is completely decoupled from view it allows lot of flexibilities to design and implement the model considering reusability and modularity. This model also can be extended for further distributed application.
It is possible to have development process in parallel for model, view and controller.
This makes the application extensible and scalable.
Drawbacks:
Requires high skilled experienced professionals who can identify the requirements in depth at the front before actual design.
It requires the significant amount of time to analyze and design.
This design approach is not suitable for smaller applications. It Overkills the small applications.

Arun MenonPosted Jan 1, 2018, 9:35 AM
Hi I am getting the error "Failed to back up Web site http://localhost/MVCDesignCSharp", can anybody help me with this,
Mohamed ElqassasPosted Apr 18, 2017, 8:39 PM
Good work.........
kalu singh raoPosted Jul 7, 2016, 1:40 AM
Nice...
Thiruppathi RPosted Jun 3, 2016, 2:47 AM
Nice Share...
pankaj bamanPosted Apr 19, 2016, 2:35 AM
asasd asdsadasd
Upendra Pratap ShahiPosted Oct 26, 2015, 9:07 AM
good one..
Ravi PatelPosted Oct 13, 2015, 1:19 AM
nice explaination
Sujeet SumanPosted Oct 12, 2015, 12:21 PM
Nice Article.............
Mohammed IbrahimPosted Oct 12, 2015, 12:11 PM
nice
RakeshPosted Oct 12, 2015, 11:44 AM
Good Article share sir
Sibeesh VenuPosted Oct 12, 2015, 3:13 AM
Nice Share
Muhammad Aqib ShehzadPosted Oct 12, 2015, 2:56 AM
nice dear
Nilesh JadavPosted Oct 12, 2015, 2:27 AM
Great work sir
Harshad PansuriyaPosted Oct 12, 2015, 2:27 AM
Nice one
Mukesh KumarPosted Oct 12, 2015, 2:26 AM
Nice share
SharadPosted Jul 17, 2015, 3:43 AM
good one...
SharadPosted Jul 17, 2015, 3:42 AM
excellent...
charu goelPosted Jan 17, 2012, 5:09 AM
Hi Nimesh, Excellent article. really very helpful. Charu
SunitaPosted Feb 28, 2011, 12:49 AM
Please post one more clear example on MVC pattern.
PriyankaPosted Apr 12, 2010, 2:18 AM
Good article
teamcoherentPosted Jan 20, 2010, 2:06 PM
Thanx Panchal its really goood article .....i got what i want in ur article.....<meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
mani kandanPosted Nov 14, 2009, 2:49 PM
Nice work!
kiran aPosted Nov 11, 2009, 1:20 AM
nice to see.. Please provide us all design patterns which are supported .net and which are the regular use and suggestble
pavani pavaniPosted May 4, 2009, 8:40 AM
mvc
shiv murtiPosted Oct 27, 2008, 3:59 AM
This is the best article for mvc,Thanks buddy
Murali MohanPosted Feb 13, 2008, 8:17 AM
Great Job
Neeraj BharatiPosted Feb 1, 2008, 8:49 AM
very helpful
Scooby ScrappyPosted Dec 27, 2007, 2:05 PM
Great work... You are a true technologist... -- Amritha
CodevillePosted Nov 6, 2007, 10:41 AM
That is certainly true. ASP.NET MVC is coming, but for now, you can implement your own MVC pattern or use a 3rd-party library. I've been involved in building an open-source *client-side* MVC library in which your .NET objects are transparently mapped to the Javascript world, then displayed through a simple templating system. When the user edits the objects, the UI is dynamically updated (including adding new controls etc.) without the need for AJAX or postbacks, and ultimately when the form is submitted, the updated .NET objects are available on the server. If this appeals to you, check out the demos linked from my blog: http://blog.codeville.net/2007/10/18/jmvcnet-neat-client-side-mvc-for-aspnet/
SekareditedPosted Aug 28, 2007, 4:17 AMEdited Aug 28, 2007, 4:19 AM
ASP.NET is not a true MVC tool
sara parkPosted Jul 27, 2007, 4:05 PM
I am working in VisualStudios 2005 and the code provided above is not opening,it says it needs a convertor. I am looking for simple model veiw controller code so as to acess the data on to the web forms. If any one has it please post as soon as possible .I am badly in need of it Thanks
ElmoPosted Jun 12, 2007, 1:25 AM
I've seen several examples of asp.net explaining how the code behind classes will serve as the control in an MVC pattern but I think this is wrong and will quickly cause an app to degenerate into one that is difficult to maintain and extend. The problem with the code behind is that it is very tightly coupled to the asp page itself meaning that you use the code behind classes as your controller, you then cannot reuse them for other, non-asp page based views. Moreover, classes that are tightly coupled to asp pages are very difficult to test which should be one of the goals of the MVC pattern. A better way is to create a completely separate controller class and have the code behind class marshall all of its events out to that class.
ElmoPosted Jun 12, 2007, 1:24 AM
I've seen several examples of asp.net explaining how the code behind classes will serve as the control in an MVC pattern but I think this is wrong and will quickly cause an app to degenerate into one that is difficult to maintain and extend. The problem with the code behind is that it is very tightly coupled to the asp page itself meaning that you use the code behind classes as your controller, you then cannot reuse them for other, non-asp page based views. Moreover, classes that are tightly coupled to asp pages are very difficult to test which should be one of the goals of the MVC pattern. A better way is to create a completely separate controller class and have the code behind class marshall all of its events out to that class.
BobPosted May 21, 2007, 3:46 PM
Nimesh wrote For easy configuration and simplification I have used XML files as data source for this application. You can't really skip over this part. For the article to be really useful, you need to include the database part. If you've used MVC with a real database, it shouldn't be too hard. You're off to a good start though.
Nakul LandePosted Feb 19, 2007, 5:05 AM
The article is good and much closed to the concept. But The example do not serve the need to explain the same at practicle level
Pushkar KumarPosted Feb 12, 2007, 1:37 AM
Thanks a Lot man. Now i m little bit confident about MVC.