Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2016, 09:05 PM
Authorized User
 
Join Date: Nov 2016
Posts: 17
Thanks: 2
Thanked 0 Times in 0 Posts
Default Ch 8 p 290 Banner

Hello,

I've worked through Ch8, followed instructions as well as I can and everything seems to work OK. However, I cannot seem to get only one of the Banners to appear at a time. I get both vertical and horizontal banners on both DarkGray and Monochrome pages. Any suggestions on how do I get this straightened out?

Thanks.
 
Old November 14th, 2016, 03:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Maybe the other banner is coming from the Master page?

If that doesn't help, please post your code for the content page, the user control and your master page.

Cheers,

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!
 
Old November 14th, 2016, 10:21 PM
Authorized User
 
Join Date: Nov 2016
Posts: 17
Thanks: 2
Thanked 0 Times in 0 Posts
Default Ch 8 p290 Banner

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;
    }
  }
}
 
Old November 15th, 2016, 07:43 AM
Authorized User
 
Join Date: Nov 2016
Posts: 17
Thanks: 2
Thanked 0 Times in 0 Posts
Default Furthermore

I am also receiving the following Error for all choices from the menu bar.

Error 404.0 The Resource you are looking for has been moved, had its name changed, or is temporarily unavailable.
 
Old November 15th, 2016, 10:20 PM
Authorized User
 
Join Date: Nov 2016
Posts: 17
Thanks: 2
Thanked 0 Times in 0 Posts
Default VS Problem

Hello,

I am having severe problems with VS following an update last weekend. So my problems my be rooted in that.
 
Old November 16th, 2016, 01:46 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

For the 404 errors, take a look here: Confusion in chapter 7 about .aspx extension in the sitemap

You may have to add the .aspx extensions (temporarily) to the pages in the sitemap file until later in the book you install the friendly URL package.

Cheers,

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
The banner problem vbboyd BOOK: Beginning ASP.NET 4.5 : in C# and VB 5 March 26th, 2013 12:39 PM
Chapter 11 page 290 Decks.cs dampyr BOOK: Beginning Visual C# 2010 3 November 20th, 2011 06:27 AM
ch 10 Banner Advertisement, setInterval socosean BOOK: Beginning JavaScript 4th Edition 0 October 11th, 2011 10:46 AM
intresting banner? sirup_segar Dreamweaver (all versions) 1 May 30th, 2007 04:25 AM
Adding banner to this code einarhansen Classic ASP Basics 0 November 29th, 2003 08:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.