Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 27th, 2015, 06:40 PM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2015
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 8 Banner - both visible

Hi,

I've been trying to work out why both banners are visible when the page loads.

Here is the code

Banner.aspx
<%@ Control Language="C#" AutoEventWireup="false" 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" AlternateText="This is a sample banner" ImageUrl="~/Images/Banner120x240.gif" />
</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" AlternateText="This is a sample banner" ImageUrl="~/Images/Banner468x60.gif" />
</a>
</asp:Panel>

Code Behind
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; }

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;
}
}

protected void Page_Load(object sender, EventArgs e)
{
HorizontalPanel.Visible = false;
VerticalPanel.Visible = false;

switch (DisplayDirection)
{
case Direction.Horizontal:
HorizontalPanel.Visible = true;
HorizontalLink.HRef = NavigateUrl;
break;
case Direction.Vertical:
VerticalPanel.Visible = true;
VerticalLink.HRef = NavigateUrl;
break;
}
}

SiteMaster.aspx

<Wrox:Banner ID="Banner1" runat="server" DisplayDirection ="Horizontal" />
}

Can you help please?
Thanks!
Reply With Quote
  #2 (permalink)  
Old October 27th, 2015, 07:07 PM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,955
Thanks: 79
Thanked 1,556 Times in 1,533 Posts
Default

Maybe because you have another Banner control
in the page that uses this master?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 8 pg 289 Clicking Button doesn't change banner RobinP2K1 BOOK: Beginning ASP.NET 4 : in C# and VB 2 March 4th, 2013 09:56 PM
Chapter 8: banner web user control Antonius Block BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 August 6th, 2012 04:31 AM
Wrox:Banner (Chapter 11) Derrick T. Davidson BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 November 17th, 2011 10:40 PM
Chapter 8 Banner not being displayed in Chrome or Firefox TreyC BOOK: Beginning ASP.NET 4 : in C# and VB 2 May 27th, 2010 09:27 AM
Banner missing from Chapter 3 paleboat BOOK: Professional Joomla! ISBN: 978-0-470-13394-1 0 April 14th, 2009 05:20 PM



All times are GMT -4. The time now is 11:06 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.