Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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 Search this Thread Display Modes
  #1 (permalink)  
Old November 3rd, 2010, 02:11 PM
Authorized User
 
Join Date: Feb 2010
Location: Annapolis, MD USA
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
Reply With Quote
  #2 (permalink)  
Old November 3rd, 2010, 02:13 PM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #3 (permalink)  
Old November 3rd, 2010, 02:22 PM
Authorized User
 
Join Date: Feb 2010
Location: Annapolis, MD USA
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.
Reply With Quote
  #4 (permalink)  
Old November 3rd, 2010, 02:58 PM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
demac3 (November 3rd, 2010)
  #5 (permalink)  
Old November 3rd, 2010, 03:32 PM
Authorized User
 
Join Date: Feb 2010
Location: Annapolis, MD USA
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.
Reply With Quote
  #6 (permalink)  
Old November 3rd, 2010, 03:34 PM
Authorized User
 
Join Date: Feb 2010
Location: Annapolis, MD USA
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!
Reply With Quote
  #7 (permalink)  
Old November 3rd, 2010, 03:40 PM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #8 (permalink)  
Old November 3rd, 2010, 03:44 PM
Authorized User
 
Join Date: Feb 2010
Location: Annapolis, MD USA
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Fantastic! Thank you again for your quick replies.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 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



All times are GMT -4. The time now is 11:26 AM.


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