My Simple App MVC1

Assalamualikum Here we gonna explore first simple app of MVC(Model View Controller).
MVC stands for Model-View-Controller, a design pattern that’s very popular in the web development space. As an alternative to Web Forms, ASP.NET MVCtakes a different approach when it comes to structuring web applications. This means you won’t be dealing with ASPX pages and controls, postbacks or view state, or complicated event lifecycles. Instead, you’ll be defining controllers, actions, and views. The underlying ASP.NETplatform is
the same, however, so things like HTTPhandlers and HTTPmodules still apply, and you can mix MVCand Web Forms pages in the same application. Both ASP.NETWeb Forms and ASP.NET MVCsit alongside each other on top of the core ASP.NETplatform.
The model—The domain that your software is built around.
The view—The visual representation of a model, given some context. It’s usually the resulting markup that the framework renders to the browser.
The controller—The coordinator that provides the link between the view and the model. The controller is responsible for processing input, acting upon the model, and deciding on what action should be performed, such as rendering a view or redirecting to another page.
Now lets start our new project named “MY MVC1” and select C# language then select ASP.NET MVC project then a window gets populated select Empty project.
2. Observe that we find additional directories in solution as “Controller,Model,View and Content” which represents our ASP.NET MVC solution. Right Click on Controller then select New Controller and Give name as MYMVC1Cotroller…
3. A New class gets created inside Controller directory with a default method named as “Index” whose return type is ACTIONRESULT which is View.
4. Right click your Action Result method and select to create new view then a new window populates which asks to use razor view engine(CSHTML) or asp c#(ASPX) then select ASPX.So your controller should be like as shown below:
now lets work with view and should be like as below:
Now when you execute error is encountered because the controller is need to be set which is shown as in the url..
Thats all for the day…We shall continue it at some other time till then good Bye..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s