Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
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 June 29th, 2010, 12:58 PM
Registered User
 
Join Date: Jun 2010
Posts: 5
Thanks: 4
Thanked 0 Times in 0 Posts
Default Problem with Chapter 8 Try It Out and "Direction.cs"

Chapter 8, p. 284 Try it out using C#:

I created the enum using the directions in the book.

The class file "Direction" looks like this (I checked my code against the source I downloaded for the book and the two files appear to be identical):

Code:
public enum Direction
{
  Horizontal,
  Vertical
}
At step 4 I add the following code as specified to the code-behind of "Banner.ascx" like this:

Code:
public partial class Controls_Banner : System.Web.UI.UserControl
{
  public Direction DisplayDirection { get; set; }
  
  protected void Page_Load(object sender, EventArgs e)
  {
    ...
  }
}
Intellisense balks on the Direction property, the error msg is "the type or namespace name Direction cannot be found...."

I ran through everything up to this point twice in the chapter, deleting the user control and the class file and recreating them each time.

Any ideas on what I'm doing incorrectly?

Thanks for your help (and thanks for an easy-to-follow primer on .NET 4)!
 
Old June 29th, 2010, 01:07 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,

The enum looks good to me too.

Where exactly did you define it? E.g. in what file and folder? And is there any other code in that file? And how does the rest of the code for Banner.ascx.cs look like?

What happens when you uncomment the code that tries to make use of the Direction (e.g. the line with the automatic property in the Banner code behind)? Does the remaining code (including the enum) compile corrrectly?

Finally, try saving all changes and restart Visual Studio. Maybe it just hasn't picked up the changes.

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:
sycomputing (June 29th, 2010)
 
Old June 29th, 2010, 01:38 PM
Registered User
 
Join Date: Jun 2010
Posts: 5
Thanks: 4
Thanked 0 Times in 0 Posts
Default Ah...

Restarting the IDE fixed the problem

(I wonder why rebuilding the site didn't seem to have any effect???)

Thank you for your reply. I'll make sure to get the basics out of the way next time!
 
Old June 30th, 2010, 02:23 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Next time, you can also try right-clicking the web site and choosing Build or Rebuild. That forces VWD to compile the site which may work as well.

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:
sycomputing (June 30th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem: Chapter 7 "Saving Your To-Do List" (Page 218) DrGaribaldi BOOK: Professional Android 2 Application Development 2 March 21st, 2011 01:53 AM
Problem: Chapter 8 "Mapping Earthquakes Example" (Page 282) DrGaribaldi BOOK: Professional Android 2 Application Development 3 July 29th, 2010 06:24 PM
Problem: Chapter 7 "Creating and Using an Earthquake Content Provider" (Page 232) DrGaribaldi BOOK: Professional Android 2 Application Development 0 June 17th, 2010 04:07 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Why do we need to maintain "static" methods in the Article.cs? Jyothi_23 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 April 13th, 2009 01:55 PM





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