Wrox Programmer Forums
|
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 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 September 2nd, 2011, 04:27 PM
Registered User
 
Join Date: Sep 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 p 284-287

Greetings, I'm getting an Compilation Error. I have a funny feeling its something completely common and easy to take care of. But I'm new to this environment.
Help would be greatly appreciated.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'Direction' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Tem porary ASP.NET Files\root\05db32ea\8e995263\assembly\dl3\419447d6 \72ba2997_ad69cc01\Planet_Wrox.DLL' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Tem porary ASP.NET Files\root\05db32ea\8e995263\App_Code.pyttdrid.dll '

Source Error:


Line 42: <br />
Line 43: <br />
Line 44: <Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Horizontal" />
Line 45: </div>
Line 46: <div id="Footer">Footer goes here</div>

Source File: c:\Users\bj\Documents\Visual Studio 2010\Projects\Planet_Wrox\Planet_Wrox\MasterPages\ Frontend.Master Line: 44

Banner.ascx.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Planet_Wrox.Controls
{
    public partial class Banner : System.Web.UI.UserControl
    {
        public Direction DisplayDirection { get; set; }
  
        protected void Page_Load(object sender, EventArgs e)
        {
            HorizontalPanel.Visible = false;
            VerticalPanel.Visible = false;

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



        }
    }
}
Banner.ascx
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Banner.ascx.cs" Inherits="Planet_Wrox.Controls.Banner" %>
<asp:Panel ID="VerticalPanel" runat="server">
    <a href="http://p2p.wrox.com" target="_blank">
    <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">
<asp:Image ID="Image2" runat="server" AlternateText="This is a sample banner" ImageUrl="~/Images/Banner468x60.gif" />
</a>
</asp:Panel>
Direction.cs
Code:
public enum Direction
{
    Horizontal,
    Vertical
}
Frontend.Master
HTML Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Frontend.master.cs" Inherits="Planet_Wrox.MasterPages.Frontend" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div id="PageWrapper">
        <div id="Header"><a href="~/" runat="server"></a></div>
        <div id="MenuWrapper">
            <asp:Menu ID="Menu1" runat="server" CssClass="MainMenu" 
                DataSourceID="SiteMapDataSource1" Orientation="Horizontal" 
                StaticEnableDefaultPopOutImage="False"></asp:Menu>
            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
                ShowStartingNode="False" />
            <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" 
                ShowExpandCollapse="False">
            <LevelStyles>
            <asp:TreeNodeStyle CssClass="FirstLeveMenuItems" />
            </LevelStyles>
            </asp:TreeView>
        </div>
        <div id="MainContent">
            <asp:SiteMapPath ID="SiteMapPath1" runat="server">
            </asp:SiteMapPath><br /><br />
        <asp:ContentPlaceHolder ID="cpMainContent" runat="server">
        </asp:ContentPlaceHolder>
        </div>
        <div id="Sidebar">
        Select a theme:<br />
            <asp:DropDownList ID="ThemeList" runat="server" AutoPostBack="True" 
                onselectedindexchanged="ThemeList_SelectedIndexChanged">
                <asp:ListItem>Monochrome</asp:ListItem>
                <asp:ListItem Value="DarkGrey">DarkGrey</asp:ListItem>
            </asp:DropDownList>
            <br />
            <br />
            <br />
            <Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Horizontal" />
            </div>
        <div id="Footer">Footer goes here</div>
    </div>
    </form>
</body>
</html>
 
Old September 3rd, 2011, 08:30 AM
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,

Sounds like you created a Web Application Project rather than a Web Site Project. WAPs don't support the App_Colder (but they allow you to place code files anywhere else).

Take a look at chapter 2, page 37 for instructions on creating the proper project type for this book. Refer to page 34 for an explanation of the differences.

If you want to continue with the book without recreating the site, you can use the site from Chapter 7 (from the code download that comes with this book) as your starting point for this chapter.

Hope this helps,

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
Chapter 6 - Code Download Missing for this Chapter dbaechtel BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 0 August 11th, 2009 11:02 AM
284 Errors, 3 Warnings in sketcher Ch15 bgwinn Visual C++ 2005 3 August 6th, 2008 05:40 PM
1>Sketcher - 284 error(s), 3 warning(s) shade cat BOOK: Ivor Horton's Beginning Visual C++ 2005 1 July 21st, 2008 08:50 PM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM





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