Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : 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 16th, 2011, 07:23 AM
Authorized User
 
Join Date: Jan 2011
Posts: 10
Thanks: 3
Thanked 1 Time in 1 Post
Default Chapter 6 - problems

hello.

I've got some trouble in chapter 6 when changing class for masterpage.frontend, now i got an error message:

ContentPlaceHolders not member of ASP.masterpages_frontend_master, getting det same message for ContentTemplates, InstantiateContentPlaceHolder.

I don't understand what is wrong. Tried to change back to System.Web.UI.Page, but still get det same message...

Can you help?

BTW, great book!

Kent from Norway
 
Old January 16th, 2011, 07:59 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,

Can you provide more detail about the following:

1. The exact steps you carried out for quote: "when changing class for masterpage.frontend".

2. The exact error message you're getting?

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 January 16th, 2011, 08:34 AM
Authorized User
 
Join Date: Jan 2011
Posts: 10
Thanks: 3
Thanked 1 Time in 1 Post
Default chapter 6

hi.

First i created the BasePage:

Code:
Imports Microsoft.VisualBasic

Public Class BasePage
    Inherits System.Web.UI.Page

    Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        If Me.Title = "Untitled Page" Or String.IsNullOrEmpty(Me.Title) Then
            Throw New Exception("Page title cannot be ""Untitled Page"" or an empty string.")
        End If
    End Sub
End Class
Then I changed the class for Login.aspx.vb like this:

Code:
Partial Class Login
    Inherits BasePage
End Class
Tried it in the browser at this worked fine.

Then i changed System.Web.UI.Page to BasePage for the Default.aspx.vb and the Frontpage.master.vb, saved the changes. this code-files looks like this:

Code:
Partial Class Masterpage_Frontend
    Inherits BasePage
End Class
Code:
Partial Class _Default
    Inherits BasePage

End Class
After these changes i'm getting errors, in the explorer this looks like this:

Kildefeil:

Linje 1:
Linje 2: Partial Class Masterpage_Frontend
Linje 3: Inherits BasePage
Linje 4: End Class

I tride to change back til System.Web.UI.Page, but same error.

any ide what is wrong?
 
Old January 16th, 2011, 08:43 AM
Authorized User
 
Join Date: Jan 2011
Posts: 10
Thanks: 3
Thanked 1 Time in 1 Post
Default

BTW - i VWD it's a file named: App_Web_sfzoihn.0.vb where the errors are pointed against.
I got 8 errors where it says at ContentPlaceHolders, ContentTemplates, InstantiateInContentPlaceHolder is not a member of ASP.masterpages_frontend_master.
 
Old January 16th, 2011, 08:46 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, I see.

You should only let Web Forms (.aspx pages) inherit BasePage. You shouldn't touch the code behind and the inherits statement for the Master Page.

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:
kent1975 (January 16th, 2011)
 
Old January 16th, 2011, 09:28 AM
Authorized User
 
Join Date: Jan 2011
Posts: 10
Thanks: 3
Thanked 1 Time in 1 Post
Default

Thanks, that worked fine. I changed the code in Masterpage and didn't notice that this inherits from Masterpage and not Page.
Then I'm back on track..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with chapter 1 macuser BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 2 April 2nd, 2009 12:39 PM
Chapter 6 problems slannesh7 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 August 15th, 2007 12:52 PM
Problems with Chapter 3 Steve887 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 12 January 18th, 2007 07:43 PM





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