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 November 3rd, 2010, 02:11 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default Chapter 8 - Banners

I have an error - can you help me resolve it?

Error 1 Type 'Direction' is not defined. c:\BegASPNET\Site\Controls\Banner.ascx.vb 5 39 c:\BegASPNET\Site\

Code:
Partial Class Controls_Banner
  Inherits System.Web.UI.UserControl

  Public Property DisplayDirection As Direction

  Public Property NavigateUrl() As String
    Get
      Dim _navigateUrl As Object = ViewState("NavigateUrl")
      If _navigateUrl IsNot Nothing Then
        Return CType(_navigateUrl, String)
      Else
        Return "http://p2p.wrox.com"  ' Return a default value
      End If
    End Get
    Set(ByVal Value As String)
      ViewState("NavigateUrl") = Value
    End Set
  End Property

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    HorizontalPanel.Visible = False
    VerticalPanel.Visible = False
    Select Case DisplayDirection
      Case Direction.Horizontal
        HorizontalPanel.Visible = True
        HorizontalLink.HRef = NavigateUrl
      Case Direction.Vertical
        VerticalPanel.Visible = True
        VerticalLink.HRef = NavigateUrl
    End Select
  End Sub
End Class
 
Old November 3rd, 2010, 02:13 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,

Did you define the Direction enum in the App_Code folder? And then saved all files?

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 3rd, 2010, 02:22 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Imar,

I copied the two files under App_Code folder from your source documents to replace mine. I then followed the instructions for the first Try It Out in Chapter 8. I have re-read this area and I don't see any instructions to change the App_Code area.
 
Old November 3rd, 2010, 02:58 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
any instructions to change the App_Code area.
Not sure what you mean exactly. You need to create the Direction enum in the App_Code folder directly. Did you do that? What's the name of the file and what code does it contain?

DId you save and close all open files? Or try to restart VWD? Sometimes VWD doesn't pick up the changes in App_Code...

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!
The Following User Says Thank You to Imar For This Useful Post:
demac3 (November 3rd, 2010)
 
Old November 3rd, 2010, 03:32 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default

That did the trick! The solution you provided solves my problem. My other question is How would I have known to do this? I assume there is a place in the book that asked me to create that code, but I cannot find it. I'm only curious, since getting past this error was the important issue.
 
Old November 3rd, 2010, 03:34 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default

This message is sent because I forgot to rate the answer I received - excellent as usual!
 
Old November 3rd, 2010, 03:40 PM
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 enum code / instructions take a look at the exercise on page 284 You create the file in step 1 and add the code in step 2.

In step 8 you find instructions about using and closing all files if IntelliSense doesn't recognize the enum.

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 3rd, 2010, 03:44 PM
Authorized User
 
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Fantastic! Thank you again for your quick replies.





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
To display the banners in sequential manner jijish SQL Language 3 January 4th, 2009 05:42 PM
To display the banners in sequential manner jijish ASP.NET 2.0 Professional 0 January 3rd, 2009 06:01 AM
Chapter 8: User Controls - Shows all banners VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 April 9th, 2008 03:45 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.