Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
We have basic page life cycle in ASP.NET.
pre_init,init,initcomplete,pre_load,load,load_complete,control_events,load_complete,
pre_render,save_state_complete,render,unload
In an application we are retrieving some data from the database and showing it in the form.
How we can categorise each event in that basic flow of Model View Controller architecture.
From UI we are hitting the data base using MVC and retrieving results showing it to the UI again with the help of MVC.
can you help me out?
Posted
Updated 28-Jun-11 4:11am
v2

Hello,

I think this may help you
Understanding ASP.NET MVC (Model View Controller) Architecture for Beginners[^]

Thanks
sanjeev
 
Share this answer
 
 
Share this answer
 
Go with following tutorials :

Scottgu's Blog[^]

this will help you a lot

also you can google for MVCMusicStore+Codeplex

here you can find demo application + guide as well

Regards :) ,

-Sagar Solanki
 
Share this answer
 
or try this

http://www.asp.net/mvc[^]
 
Share this answer
 
Quote:
From UI we are hitting the data base and retrieving results showing it to the UI.
can you help me out?

No, you normally shouldn't be hitting the DB from the UI in an MVC application.

Client page requests are routed to the appropriate controller and action. So, "http://localhost:4004/home/index" will go to the HomeController and the Index action.

Inside that action, you'll likely make a call to a repository or something to load your data. This is called your model. So, you're loading your model in your controller, then passing that to your view, the final part of the process.

The view - written either with the new Razor syntax or the ASPX syntax you're used to - is used to generate the HTML output given the model you've provided.

In this light, the process feels much simpler because we throw out a lot of the complexities of the page load/event model stuff, but it is a different paradigm to get used to.

Hope this helps some. Cheers.
 
Share this answer
 
v2
Comments
sushil_gupta 28-Jun-11 10:09am    
Actually you are correct.From UI using MVC we are hitting DB taking the results and again using MVC displaying to UI. Can you give me detailed explaination?what is the exact process? what are event takes place in which part?It will be great help.
TheyCallMeMrJames 28-Jun-11 10:46am    
Hi again,

I am actually saying that it ISN'T the UI that will be hitting the database. MVC is a VERY different style of development from Page Controller (ASPX), and there isn't an event model as you're used to.

Take an hour or so and watch this video: http://channel9.msdn.com/Events/DevDays/DevDays-2011-Netherlands/Devdays002

It will definitely get you moving in the right direction.

Cheers.
Member 8543245 30-May-13 8:00am    
My Controller name is HomeController but in Url we get appropriate result only of http://localhost:4004/home/index instead of http://localhost:4004/homeController/index

why is it so?
where the mapping is done Home-> HomeController?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900