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

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

January 6th, 2009, 04:31 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

January 6th, 2009, 12:12 PM
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
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.
|
|

January 7th, 2009, 03:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're welcome.
I'll have this change added to the errata section of the book.
Cheers,
Imar
|
|

June 10th, 2009, 12:44 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

June 10th, 2009, 12:58 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

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

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

June 10th, 2009, 01:16 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
 |