Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : 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 January 20th, 2016, 08:56 PM
Registered User
 
Join Date: Jan 2016
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 8 [p.286] - Creating Smarter User Controls

Hey all,

I'm really stuck on this part and can't seem to debug the issue. Please lend me your collective wisdom to resolve this!

I have Direction.cs in App_code, which only contains an enum (as the instructions say to do).

I have registered Wrox:Banner in Web.Config and triple checked to ensure all is correct (everything was working in the previous step.... adding the property has broken it somehow).

My banner code behind matches the solution Wrox has, except I've had to wrap it in the following:

Code:
namespace begASPNET.Controls
So the compiler knew what HorizontalPanel and VerticalPanel was. Otherwise, it underlined them in red asking me to define them.

When I go to run my code, I'm getting this error:

Code:
Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0433: The type 'Direction' exists in both 'c:\Users\Nathan\AppData\Local\Temp\Temporary ASP.NET Files\root\ed4229d3\db275704\assembly\dl3\1436ea22\761a90a6_e453d101\begASPNET.DLL' and 'c:\Users\Nathan\AppData\Local\Temp\Temporary ASP.NET Files\root\ed4229d3\db275704\App_Code.mh0y1mym.dll'

Source Error:


Line 41:             <br />
Line 42:             <br />
Line 43:             <Wrox:Banner ID="Banner1" runat="server" DisplayDirection="Horizontal" />
Line 44:         </aside>
Line 45:         <footer>Footer Goes Here</footer>

Source File: c:\Users\Nathan\Documents\Visual Studio 2013\Projects\begASPNET\begASPNET\MasterPages\Frontend.Master    Line: 43
It's not liking my Wrox:Banner and I'm really at a loss...
 
Old January 21st, 2016, 09:38 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Does it work when you move the file out of App_Code? I am thinking you created a Web Application Project and not a Web Site Project. When you expand a page like Default.aspx, how many code behind files does it have? Do you see a .designer.cs file?

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!
 
Old January 22nd, 2016, 08:24 AM
Registered User
 
Join Date: Jan 2016
Posts: 5
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
Does it work when you move the file out of App_Code? I am thinking you created a Web Application Project and not a Web Site Project. When you expand a page like Default.aspx, how many code behind files does it have? Do you see a .designer.cs file?

Imar
Thanks for the reply.

Taking Direction out of app_code and placing it into the root directory seems to fix the issue.

When I expand Default.aspx, I have:
Default.aspx.cs &
Default.aspx.designer.cs

When it came time to make the project, I only had this option available:
http://i.imgur.com/nRoneBa.png

Is there a way I can keep Direction.cs in App_Code in my current project? I don't understand why my using statement isn't fixing the issue?
 
Old January 24th, 2016, 02:47 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,

Yeah, it's what I thought. You created a Web Application, not a Web Site which behaves differently.

>> When it came time to make the project, I only had this option available:

Yes, because you chose File | New Project, not File New Web site.

Checkout the section "Different Project Types" on page 34 and further for the differences between the two and the exercise on page 38, especially step 2, for detailed instructions of what you should have done.

I would recommend taking the source from Chapter 7 that comes with the book and use that as your starting point for Chapter 8.

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:
natenate (January 25th, 2016)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 page 286 ? liamfitz BOOK: Access 2010 VBA Programmer's Reference 7 August 16th, 2013 03:43 AM
Chapter 08: Creating Smarter User Controls huttog BOOK: Beginning ASP.NET 4 : in C# and VB 5 June 29th, 2012 03:16 AM
Chapter 8 User Controls: Try It Out Pages 283-286 epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 October 11th, 2009 11:53 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





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