19 April 2014

Changing Views and Layout -- MVC Basics

We can change the Layout page and view page of our project. 

Let us start with an Instance....Create a new project, named it as 'Countries'.

The default project will run like this.


We want to change the heading 'My Mvc Application' which is common to all pages to 'Country Lists'
Go to Views>>Shared>>_Layout.cshtml
 

 



Change the title to 'Country Lists'


Run the project

 

Next change the Index View page

 

 
Change the Content....

 
 

Run the project to see the changes...

 

to Change the message 'Welcome to ASP.NET MVC'..,Go to Home Controller>>Index method


Change the ViewBag Data.

 

Run the project to see the changes 

No comments:

Post a Comment