Step 3 of page 289 states that the button click will change the banner from vertical to horizontal because the Page_Load handler will not be run so the property on the page will not be affected, which is set at horizontal. However, my banner remains vertical after clicking the button. It seems the Page_Load handler is being run when the button is clicked which I understand is supposed to be a PostBack (and not supposed to run Page_Load?)
AboutUs.aspx:
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">
<!-- Copyright (C) 2013 -->
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
Robin P
Skills: <br />
<asp:Button ID="Button1" runat="server" Text="Button" />
<br />
<Wrox:Banner ID="Banner2" runat="server" DisplayDirection="Horizontal" />
</asp:Content>
Code Behind AboutUs.aspx.cs:
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)
{
Banner2.DisplayDirection = Direction.Vertical;
}
}
I am using MVS Express 2012 for Web if that makes a difference. Thanks!
Robin