Wrox Programmer Forums
|
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
 
Old June 13th, 2010, 10:24 PM
Authorized User
 
Join Date: Dec 2009
Posts: 63
Thanks: 18
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Wilfredo Rosado
Default Something went horribly wrong!

After performing step 5 in Chapter 7, page 251 for another website I am working on, I recieved errors after pressing CTRL + F5. Apparently the /about/default.aspx, /services/default.aspx, and /contact/default.aspx are the culprits, but I cannot find anything wrong with them.

Here are the first 5 errors when compiling:
Code:
Error	1	'Title' is not a member of 'ASP.about_default_aspx'.	C:\temp\Home-Remake\About\Default.aspx	

Error	2	'InitializeCulture' is not a member of 'ASP.about_default_aspx'.	C:\temp\Home-Remake\About\Default.aspx	1

Error	3	'MasterPageFile' is not a member of 'ASP.about_default_aspx'.	C:\temp\Home-Remake\About\Default.aspx	1

Error	4	'AddContentTemplate' is not a member of 'ASP.about_default_aspx'.	C:\temp\Home-Remake\About\Default.aspx	3

Error	5	'AddContentTemplate' is not a member of 'ASP.about_default_aspx'.	C:\temp\Home-Remake\About\Default.aspx	5
As you cane see its the default.aspx under the folder About, which is causing the problem. remove the file and it compiles OK, but I now cannot make the default page for About Us.

Got any ideas,
Fred Rosado

Here is my /about/default.aspx code. The <%@ Page line gets a blue sguiggly line under it. If you hover over the line it says, " 'Context' is not a member of 'Default' ":
Code:
  <%@ Page Title="About Home-Remake" Language="VB" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
</asp:Content>
Here is my web.sitemap code:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/" title="Welcome"  description="Welcome to Home-Remake">
    <siteMapNode url="~/Default.aspx" title="Welcome"  description="Go to the Welcome page" />
    <siteMapNode url="~/Services/Default.aspx" title="Services" description="Services on this site">
      <siteMapNode url="~/Services/Carpentry.aspx" title="Carpentry" description="Carpentry" />
      <siteMapNode url="~/Services/Electrical.aspx" title="Electrical" description="Electrical" />
      <siteMapNode url="~/Services/Plumbing.aspx" title="Plumbing" description="Plumbing" />
      <siteMapNode url="~/Services/Drywall.aspx" title="Drywalling" description="Drywall" />
      <siteMapNode url="~/Services/Tile.aspx" title="Tiling" description="Floor and wall tiles" />
    </siteMapNode>
    <siteMapNode url="~/Photos/Default.aspx" title="Photo Gallery" description="Photo Gallery">
      <siteMapNode url="~/Photos/Client.aspx" title="By Client" description="Show by client" />
      <siteMapNode url="~/Photos/Type.aspx" title="By Type" description="Show by type" />
      <siteMapNode url="~/Photos/Town.aspx" title="By Town" description="Show by town" />
      <siteMapNode url="~/Photos/All.aspx" title="All" description="Show all photos" />
    </siteMapNode>
    <siteMapNode url="~/About/Default.aspx" title="About Us" description="About Home-Remake">
      <siteMapNode url="~/About/Login.aspx" title="Log In" description="Log in to your account" />
      <siteMapNode url="~/About/Contact.aspx" title="Contact Us" description="Send us an email" />
    </siteMapNode>
  </siteMapNode>
</siteMap>
 
Old June 14th, 2010, 02:28 AM
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,

Is your template set up correctly? Take a look at this:

Code:
 
<%@ Page Title="About Home-Remake" Language="VB" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Default" %>
It should inherit _Default (with an underscore) as Default is a reserved word in VB...

Hope this helps,

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:
Wilfredo Rosado (June 15th, 2010)
 
Old June 15th, 2010, 03:20 AM
Authorized User
 
Join Date: Dec 2009
Posts: 63
Thanks: 18
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Wilfredo Rosado
Smile

Thanks Imar...Like usual, you always come through for me. I checked the template and even recreated a new one being careful not to miss a step, but it still didn't put the _Default. After the fact, I kind of remembered reading in one of the earlier chapters, something about having to manually change the Default to _Default. So I did in both the Default.aspx and it's Code Behind. It works like a champ now.

Do you still think the template should have automatically put the underscore in front of the word default? ...Fred
 
Old June 15th, 2010, 04:16 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
Do you still think the template should have automatically put the underscore in front of the word default?
No, it shouldn't. I think it's actually a bug in the book. It works fine for all pages except for Default.aspx which, unfortunately, is quite a common name ;-)

In the 4.0 version of the book I fixed it like this:

Public Partial Class $relurlnamespace$_$safeitemname$

This adds the underscore for *all* pages in the root (which is OK), but has an added benefit in that it correctly creates classes named after sub folders. So a page called Default.aspx in the About folder ends up as About_Default

You can use the same trick in Visual Studio 2008.

Hope this helps,

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:
Wilfredo Rosado (June 15th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
We're sorry, but something went wrong. barryjogorman BOOK: Beginning Ruby on Rails 3 July 11th, 2010 07:37 PM
Where am I going wrong ? fredb23 Classic ASP Databases 3 August 10th, 2004 04:56 AM
What's wrong with this??? stacy Classic ASP Databases 2 May 12th, 2004 07:22 AM





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