ASP.NET - create a master page with Header,Main body and Footer in below of page

Asked By aman on 21-Jul-11 02:47 AM
hi all,

thanks for ur previous reply
i am not able to create a master page with Header , main Body and footer below
please help me
give some example

Thanks
Aman khan
Reena Jain replied to aman on 21-Jul-11 02:48 AM
Hi,

To add a master page to a web project, right-click your web project in the Solution Explorer window, select Add New Item, and select the Master Page item type from the Add New Item dialog. The listing below shows a sample master page in source view.

Hope this will help you
dipa ahuja replied to aman on 21-Jul-11 03:04 AM
hi.. i have posted you answer.. your master file should look like this:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage3.master.cs"
  Inherits="MasterPage3" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title></title>
</head>
<body>
  <form id="form1" runat="server">
  <div>
<table runat="server">
  <tr>
    <td colspan="2">
      logo of your website
    </td>
  </tr>
  <tr>
    <td>
      Menus
    </td>
    <td>
      <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
      </asp:ContentPlaceHolder>
    </td>
  </tr>
  <tr>
    <td colspan="2">
      Bottom menus
    </td>
  </tr>
</table>
  </div>
  </form>
</body>
</html>

Now add a content file By Right Click on the Master file -> Add Content Page
Or add new webForm and choose "Select master file" checkbox in the add new item dialogbox
Now your Child page look like this:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage3.master" AutoEventWireup="true" CodeFile="Default8.aspx.cs" Inherits="Default8" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
add your child page content or controls here
</asp:Content>
 
Hope you get it!
Jitendra Faye replied to aman on 21-Jul-11 06:23 AM
Create Master page like this-

 <body>
   <table>
<tbody>
   <tr>
    <td >Header Part</td>
   </tr>
   <tr>
    <td>Body Part (Put here ContentPlaceHolder for child page)</td>
   </tr>
   <tr>
    <td>Footer Part</td>
   </tr>

    </tbody>
   </table>
</body>

Hope this will help you.