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

June 27th, 2012, 07:13 PM
|
|
Registered User
|
|
Join Date: Jun 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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
|
|

June 28th, 2012, 01:47 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
In which folder did you create the Direction enum? Can you post its code?
Imar
|
|

June 28th, 2012, 08:43 AM
|
|
Registered User
|
|
Join Date: Jun 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Direction.cs is in the App_Code folder. Here is the entirety of the code in the file.
Code:
public enum Direction
{
Horizontal,
Vertical
}
|
|

June 28th, 2012, 09:00 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

June 28th, 2012, 02:39 PM
|
|
Registered User
|
|
Join Date: Jun 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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?
|
|

June 29th, 2012, 03:16 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
 |
|