Pages

Friday, August 2, 2013

Create Layout In MVC4

Create Layout In MVC4:

1.Create SideMenu With Header Page
2.Create SideMenu Page
3.Create Layout Page.

Layout  Example Code:


<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
 <script src="../../Content/prefixfree-1.0.7.js" type="text/javascript"></script>
 <link href="../../Content/Menu.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <script src="../../Content/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Content/prefixfree-1.0.7.js" type="text/javascript"></script>
<link href="../../Content/sidemenu.css" rel="stylesheet" type="text/css" />
    
</head>
<body>
    <div>
    <table style="width:100%;height:50%">

<tr >
<td style="width:45%;top:auto;margin-left:20%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="../../Content/Images/Untitled.png" /></td>

<td style="margin-left:32%;height:50%">@Html.Partial("Menu") </td>
</tr>
<tr></tr>
</table>



<table style="width:100%">


<tr valign="top">
<td style="width:15%;top:auto" valign="top"> @Html.Partial("Sidemenu")</td>
<td style="width:85%;background-color:White;height:600px;">
        @RenderBody()
        </td>
</tr>


</table>

<div style="height:100px;background-color:Yellow;">
</div>
    </div>
</body>
</html>

My Layout Page:
 

Question How Call Page In Your Pages:

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "Your page title";
    }


Hope It will help you.....enj

No comments:

Post a Comment