Create MVC4 Empty Project

3
--Create MVC4 empty project --right click on views folder –add –new folder – name--:shared -- right click on share folder—add—view--name--:_Layout <html> <head> <link rel=”stylesheet” href=”~/content/site.css”/> </head> <body> <div id=”header”> <marquee>Chelsea</marquee> </div> <div id=”navigator”> <center> <br> @html.actionlink(“Home”,”Index”) @html.actionlink(“Product”,”product”) @html.actionlink(“About us”,”about”) @html.actionlink(“Contact us”,”contact”) </center> </div> <div id=”content”> @renderBody() </div> <div id=”sidebar”> @if(IsSectionDefined(“section1”)) {@renderSection(“section”,required:false)} Else

description

asp.net

Transcript of Create MVC4 Empty Project

Page 1: Create MVC4 Empty Project

--Create MVC4 empty project

--right click on views folder –add –new folder – name--:shared

-- right click on share folder—add—view--name--:_Layout

<html>

<head>

<link rel=”stylesheet” href=”~/content/site.css”/>

</head>

<body>

<div id=”header”>

<marquee>Chelsea</marquee>

</div>

<div id=”navigator”>

<center>

<br>

@html.actionlink(“Home”,”Index”)

@html.actionlink(“Product”,”product”)

@html.actionlink(“About us”,”about”)

@html.actionlink(“Contact us”,”contact”)

</center>

</div>

<div id=”content”>

@renderBody()

</div>

<div id=”sidebar”>

@if(IsSectionDefined(“section1”))

{@renderSection(“section”,required:false)}

Else

{Default advetisment}

</div>

Page 2: Create MVC4 Empty Project

<div id=”footer”>@@copyraight 2015</div>

</body>

</html>

Right click on views flolder—add –views—name:ViewsStart

Check “cerate as a partial views” check box

Add

@{layout=”~/viewd/shared”}

Right click on project – add—new folder—name:Content

Right click on content folderd--Add—stylesheet—name:site

#header

{height:100;width:auto;background-color:yellowgreen;}

#Navigate

{height:100;width:auto;background-color:cyan;}

#content

{height:100;width:auto;background-color:violet; float:left;}

#sidebar

{height:100;width:auto;background-color:pink; float:left;}

#footer

{height:100;width:auto;background-color:yellow; float:both;}

Create HomeController add action methods: index,about,contact,product

Create view for each action method

In inde,contact and about view add following line in <body> tag

This is my home page

Page 3: Create MVC4 Empty Project

==In product page add following code

this is my product page

@section section1

{@html.actionlink(“Samsung”,”samsung”)

@html.actionlink(“Nokia”,nokia””)

@html.actionlink(“Htc”,”htc”)

@html.actionlink(“Sony Ericson”, “sony Ericson”)}

</div>