MasterPage.master
- <%@ Master Language="C#" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <script runat="server">
- </script>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>asp.net master page example: how to use master and content page</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <h1 style="color:Red">My Site</h1>
- <hr />
- <table>
- <tr valign="top">
- <td>
- <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
- </asp:ContentPlaceHolder>
- </td>
- <td>
- <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
- </asp:ContentPlaceHolder>
- </td>
- </tr>
- </table>
- <hr />
- <div style="color:Gray">Page footer</div>
- </div>
- </form>
- </body>
- </html>
ContentPage.aspx
- <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="" %>
- <script runat="server">
- </script>
- <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
- <asp:Calendar
- ID="Calendar1"
- runat="server"
- BackColor="Orange"
- BorderColor="DarkOrange"
- ForeColor="Snow"
- >
- <TitleStyle BackColor="DarkOrange" />
- <SelectedDayStyle BackColor="Crimson" />
- </asp:Calendar>
- </asp:Content>
- <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
- <asp:Image
- ID="Image1"
- runat="server"
- ImageUrl="~/Images/sunset.jpg"
- />
- </asp:Content>
ContentPage2.aspx
- <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="" %>
- <script runat="server">
- </script>
- <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
- <asp:Calendar
- ID="Calendar1"
- runat="server"
- BackColor="DodgerBlue"
- BorderColor="DarkBlue"
- ForeColor="Snow"
- >
- <TitleStyle BackColor="DarkBlue" />
- <SelectedDayStyle BackColor="LightBlue" ForeColor="DarkBlue" />
- </asp:Calendar>
- </asp:Content>
- <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
- <asp:Image
- ID="Image1"
- runat="server"
- ImageUrl="~/Images/sea_beach2.jpg"
- Width="50%"
- Height="50%"
- />
- </asp:Content>
2 comments:
nice one
thankx
Post a Comment