Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
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 June 27th, 2012, 07:13 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Location: Columbus, GA
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 08: Creating Smarter User Controls

Using the C# version of the code.

I have created the Direction.cs with the enum Direction.

In /Controls/Banner.ascx.cs I get an error when entering "public Direction DisplayDirection { get; set; }". The app can't seem to find Direction.cs.

When I view Default.aspx in the browser it displays all right, but I get a compile error of

"Error 1 The type or namespace name 'Direction' could not be found (are you missing a using directive or an assembly reference?) C:\BegASPNETCS\Site\Controls\Banner.ascx.cs 10 10 C:\BegASPNETCS\Site\
"

So I seem to have missed a step somewhere but I'm darned if I can see it.

Thanks,

George
Reply With Quote
  #2 (permalink)  
Old June 28th, 2012, 01:47 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

In which folder did you create the Direction enum? Can you post its code?

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 June 28th, 2012, 08:43 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Location: Columbus, GA
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Direction.cs is in the App_Code folder. Here is the entirety of the code in the file.

Code:
public enum Direction
{
  Horizontal,
  Vertical
}
Reply With Quote
  #4 (permalink)  
Old June 28th, 2012, 09:00 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

That looks OK to me.

Have you tried restarting VS? As explained in the book, the changes are not always picked up right away.

Also, are you sure you created a Web Site Project and not a Web Application project (the form has one code behind file for an ASPX; the latter has two).

If that doesn't help, can you post the code for the complete control as well as the page / master page where you use it?

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:
huttog (June 28th, 2012)
  #5 (permalink)  
Old June 28th, 2012, 02:39 PM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Location: Columbus, GA
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default Thanks!

Thank you for the quick response -- it is gratifying to see an author so readily available for questions.

Oddly enough, a restart of VS resolved the issue. When I initially created this I did wait five minutes for VS to pick up on the change but it never happened. Is there a different sort of build I should have asked for when bringing up the page?
Reply With Quote
  #6 (permalink)  
Old June 29th, 2012, 03:16 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
Is there a different sort of build I should have asked for when bringing up the page?
You can force Visual Studio to compile the site. You can use Build | Build Website or right-click the site and choose Build Web site.

That should hopefully do the trick.

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
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 4, Creating Compound Controls example ejx002 BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 1 June 17th, 2009 08:32 AM
Ch.14 Creating Windows Form User Controls problem SAIFI BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 1 September 29th, 2008 05:51 AM
User controls' content: Chapter 2 User Controls AGS BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 10 July 26th, 2007 05:36 AM
Chapter 13 - Creating Your Own Custom Controls msjolin BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 February 16th, 2004 09:01 PM



All times are GMT -4. The time now is 09:13 AM.


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