Preferred Language:
Listing 5.14 - HeaderContent.aspx
Illustrates how to change a page header such as the page style within a master page.
<%@ Page Language="C#" MasterPageFile="SimpleMaster.master" %>
<script runat="server">
void Page_Load()
{
// Change the title
Page.Header.Title = String.Format("Header Content ({0})", DateTime.Now);
// Change the background color
Style myStyle = new Style();
myStyle.BackColor = System.Drawing.Color.Red;
Page.Header.StyleSheet.CreateStyleRule(myStyle, null, "html");
}
</script>
<asp:Content
ID="Content1"
ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
Content in the first column
<br />Content in the first column
<br />Content in the first column
<br />Content in the first column
<br />Content in the first column
</asp:Content>
<asp:Content
ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder2"
Runat="Server">
Content in the second column
<br />Content in the second column
<br />Content in the second column
<br />Content in the second column
<br />Content in the second column
</asp:Content>
Need ASP.NET and Visual Studio 2008 Training?
- Learn ASP.NET 3.5 from Stephen Walther, author of ASP.NET 3.5 Unleashed.
We've provided ASP.NET training for NASA, Lockheed Martin, the National Science Foundation, Verizon,
Boeing, the US House of Representatives, Kaiser, Petco, Mary Kay, and Microsoft.
Why not your company?
-
Receive a four day, hands-on, intensive workshop.
-
We fly to you, anywhere in the world.
-
We can bring our own laptops.
To learn more, visit the
Superexpert Training website.