I overlaid the master file from the Ch8 Source code.
Here are the About page and the Banner, which I also overlaid.
Code:
<%@ Page Title="About Us" Language="C#" MasterPageFile="~/MasterPages/Frontend.master" AutoEventWireup="true" CodeFile="AboutUs.aspx.cs" Inherits="About_AboutUs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<h1>About Us</h1>
<p>
Planet Wrox is a sample site that comes with the book Beginning ASP.NET 4.5 in C# and VB by Imar Spaanjaars.</p>
<p>
The site demonstrates an on-line community site designed to share reviews of CDs and concerts. Additionally, users are invited to upload pictures from concerts they have been to (the so called Gig Pics) to show the world what cool concerts they have seen.
</p>
<p>
Wrox is a trademark or registered trademark of Wiley Publishing, Inc. Used by permission.
</p>
<asp:Button ID="Button1" runat="server" Text="Button" />
<Wrox:Banner ID="Banner2" runat="server" DisplayDirection="Horizontal" />
</asp:Content>
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class About_AboutUs : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Banner2.NavigateUrl = "http://imar.spaanjaars.com";
}
}
}
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Banner.ascx.cs" Inherits="Controls_Banner" %>
<asp:Panel ID="VerticalPanel" runat="server">
<a href="http://p2p.wrox.com" target="_blank" runat="server" id="VerticalLink">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/Banner120x240.gif" AlternateText="This is a sample banner" /></a>
</asp:Panel>
<asp:Panel ID="HorizontalPanel" runat="server">
<a href="http://p2p.wrox.com" target="_blank" runat="server" id="HorizontalLink">
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/Banner486x60.gif" AlternateText="This is a sample banner" /></a>
</asp:Panel>
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Controls_Banner : System.Web.UI.UserControl
{
public Direction DisplayDirection { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
switch (DisplayDirection)
{
case Direction.Horizontal:
HorizontalPanel.Visible = true;
VerticalPanel.Visible = false;
HorizontalLink.HRef = NavigateUrl;
break;
case Direction.Vertical:
VerticalPanel.Visible = true;
HorizontalPanel.Visible = false;
VerticalLink.HRef = NavigateUrl;
break;
}
}
public string NavigateUrl
{
get
{
object _navigateUrl = ViewState["NavigateUrl"];
if (_navigateUrl != null)
{
return (string)_navigateUrl;
}
else
{
return "http://p2p.wrox.com"; // Return a default value
}
}
set
{
ViewState["NavigateUrl"] = value;
}
}
}