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 January 5th, 2009, 08:37 PM
Registered User
 
Join Date: Nov 2008
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default Chapter 6 p207/208

Hi Imar,

I'm having a few problems with this try it out exercise. At step 4, when I saved the page (Login.aspx) and viewed it in the browser, I did not get the expected error. When I then viewed the source in the browser, the title element was empty. Is it supposed to default to "Untitled page" if nothing is entered in the source?

Furthermore, when I tried step 5. there was no title attribute at the end of the @ page directive. Mine just shows:

<%@PageTitle=""Language="C#"MasterPageFile="~/MasterPages/MasterPage.master"AutoEventWireup="true"CodeFile="Login.aspx.cs"Inherits="Login" %>

When I tried to add the title attribute as per instructions I got a build error when I tried to view the page in the browser.

I take it that the code in BasePage class is designed to generate an exception if the title element = Untitled Page but this text is never generated when I create new pages. I've noticed this before when I've compared my code to yours.

Another anomaly is that my AutoEventWireup="true" whereas the example in the book is false.

Can you help me please?
 
Old January 6th, 2009, 04:31 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,

Did you apply Service Pack 1? It seems that the behavior has changed, and that new pages no longer have Untitled Page as the default, but simply an empty page....

You couuld, if you wanted to check for an empty title, change the code to:

if (string.IsNullOrEmpty(this.Title))
{
throw new Exception ("Page title can't be empty");
}

You should be able to add the Title attribute and set it to a valid title though...

Re: AutoWireUp: the samle page directive on page 208 uses VB which has this attribute to true by default. You're using C# which has it set to false.

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!
 
Old January 6th, 2009, 12:12 PM
Registered User
 
Join Date: Nov 2008
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Default Chapter 6 p207/208

Thank you very much Imar. Yes, I have Service Pack 1. I had already applied the code that you gave me as a short term fix as I thought that there was something wrong with my version of VWD200. Glad its a Vista/Service Pack 1 issue.

As for the title attribute, that was just me being stupid and its sorted now. Thanks also for the info on how VB and C# handle the AutoEventWireup attribute differently.
 
Old January 7th, 2009, 03:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome.

I'll have this change added to the errata section of the book.

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!
 
Old June 10th, 2009, 12:44 PM
Registered User
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Same Chapter - Inheritance problems

I'm working my way through the book. I'm well used to C# but not APS.net.

Anyway I created the basePage as directed and then tried the login page ( having changed the inherit ) and no error.

I tried debug mode and the BasePage code doesn't seem to run when I put a break in the Page_PreRender.

The title looks right in the source.

I am using VWD 2008 Express, Vista and IE 8.

Oh, also I have to use Compatibility mode to get the page to display correct else the footer is in the wrong place.
 
Old June 10th, 2009, 12:58 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 Jim Alexander,

Did you change the code as suggested below and in the errata?

Service Pack 1 for VWD (released after the book was published) changed the rules a bit so the exercise won't work as described in the book anymore.

If that that doesn't help, can you post the relevant code (BasePage, login code, Page directive of Login.aspx etc)?

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!
 
Old June 10th, 2009, 01:00 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

P.s. are you sure your footer code is alright? Do you see the same behavior on PlanetWrox.com (http://www.planetwrox.com/)? I don't think I see anything there that looks out of order in IE8....

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!
 
Old June 10th, 2009, 01:11 PM
Registered User
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks

I have solved the Title issue and it was me not seeing the title had a default value in the login form of "" - I had spotted the issue with master page - my stupidity.

I'll check the service pack etc - my code looks OK to me - and I'll check the errata

Thanks very much
 
Old June 10th, 2009, 01:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
and it was me not seeing the title had a default value in the login form of ""
That's the whole issue. Before SP1, the title was "Untitled Page" so the code would raise an exception if that was still the title. Now you need to check for string.IsNullOrEmpty(this.Title) as well to ensure the Title is not an empty string (of course you should only do that if you like that behavior)

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM
Chapter 5 - Try It Out: Pages 208-210 Wyatt70 BOOK: Beginning XML 3rd Edition 5 November 22nd, 2006 06:54 AM
ch 7 page 208 commit.php pipdickenz BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 September 8th, 2004 12:08 PM
PHP5 Errata - Pages 207-208 garrisrd BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 August 4th, 2004 05:54 PM





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