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

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

November 3rd, 2010, 02:13 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Did you define the Direction enum in the App_Code folder? And then saved all files?
Imar
|

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

November 3rd, 2010, 02:58 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
The Following User Says Thank You to Imar For This Useful Post:
|
|

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

November 3rd, 2010, 03:34 PM
|
Authorized User
|
|
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
|
|
This message is sent because I forgot to rate the answer I received - excellent as usual!
|

November 3rd, 2010, 03:40 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|

November 3rd, 2010, 03:44 PM
|
Authorized User
|
|
Join Date: Feb 2010
Posts: 42
Thanks: 9
Thanked 0 Times in 0 Posts
|
|
Fantastic! Thank you again for your quick replies.
|
|
 |
|