Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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
  #1 (permalink)  
Old May 28th, 2008, 08:28 AM
Registered User
 
Join Date: May 2008
Location: Hoover, AL, USA.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default BasePage and Namespace Issue

The book did not mention removing the namespace portion of the code before creating the MyBasePage. If the template retains the namespace portion, subfolders such as About and Reviews would contain namespaces Site.About and Site.Reviews. But by including the namespace, the code is not in scope with the BasePage class which is in the Site namespace.

I removed the namespace in the template I created for MyBasePage and the "Try it Out" on pages 249-252 creates an issue because of the Default classes all being in the Site namespace.

The book mentions on pages 251 & 252 that the Visual Basic versions will cause errors due to the Default reserved word, but I'm using C#. The errors I'm getting are due to the Default class being in the same namespace. I also happened to notice that the code I downloaded from WROX has the Default class described as _Default in the Default.aspx.cs in the main folder. I'm confused how this could work together.

Have I missed an important issue? I was expecting to see some posts about this here, which leads me to believe that I've missed something.

  #2 (permalink)  
Old May 28th, 2008, 08:43 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Eric,

You could leave the namespace in the template, and then simply add a using statement for the namespace of the base page.

That way, your pages will have unique names, while you can still bring in the BasePage in scope.

Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.


Similar Threads
Thread Thread Starter Forum Replies Last Post
BasePage Code for VB (Chapter 6) justinjones06 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 September 15th, 2008 01:50 AM
BasePage>>TypeInitialization exception nabeelalkaff BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 November 13th, 2007 11:30 AM
namespace issue 2BOrNot2B XSLT 1 March 9th, 2007 05:32 PM
namespace shortynelson C# 2 September 9th, 2003 03:14 AM
Namespace Help vavre ADO.NET 0 August 24th, 2003 11:39 AM





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