A simple site master and an index view in asp.net

Code for site master [site.master].


<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <asp:ContentPlaceHolder ID="head" runat="server">
 <title>Hello World</title>
 </asp:ContentPlaceHolder>
</head>
<body>
 <asp:ContentPlaceHolder ID="MainContent" runat="server">

 </asp:ContentPlaceHolder>
</body>
</html>

&nbsp;

 

Here is the code for view file [Views/Home/index.aspx]


<%@ Page Language="C#" MasterPageFile="~/site.master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:content id="Content1" ContentPlaceHolderID="MainContent" runat="server">
 <div>
 <%= Html.Encode(ViewData["Message"]) %>
 </div>
</asp:content>

&nbsp;

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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