Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : 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 30th, 2016, 05:09 PM
Registered User
 
Join Date: Jan 2016
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Please help me sort this out.

Here's my frontend.master.cs after completing all the tasks in Chapter 6. I keep getting an error when I attempt to display my default page using Chrome. The line in Bold is where I keep getting the error but I'm not sure why. Any thoughts?

Thanks in advance!

-Tim

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPages_Frontend : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string selectedTheme = Page.Theme;
HttpCookie preferredTheme = Request.Cookies.Get("PreferredTheme");
if (preferredTheme != null)
{
selectedTheme = preferredTheme.Value;
}
if (!string.IsNullOrEmpty (selectedTheme))
{
ListItem item = ThemeList.Items.FindByValue(selectedTheme);
if (item != null)
{
item.Selected = true;
}
}
}
}

protected void ThemeList_SelectedIndexChanged(object sender, EventArgs e)
{
HttpCookie preferredTheme = new HttpCookie("PreferredTheme");
preferredTheme.Expires = DateTime.Now.AddMonths(3);
preferredTheme.Value = ThemeList.SelectedValue;
Response.Cookies.Add (preferredTheme);
Response.Redirect(Request.Url.ToString());

}
}
 
Old January 30th, 2016, 05:14 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

And the error is?
__________________
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 30th, 2016, 05:21 PM
Registered User
 
Join Date: Jan 2016
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

Source Error:


Line 4: using System.Web.UI.WebControls;
Line 5:
Line 6: public partial class MasterPages_Frontend : BasePage
Line 7: {
Line 8: protected void Page_Load(object sender, EventArgs e)

Source File: e:\Tim's Stuff\Grantham College stuff\Classes and Class Materials\IS 212 dotNET implementation\BegASPNET\MasterPages\Frontend.mast er.cs Line: 6
 
Old January 30th, 2016, 05:23 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Ah, there we go.

This page is a master page, but you let it inherit BasePage which is a Page. The two are not compatible. Just change BasePage back to MasterPage and it should work again.

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!
The Following User Says Thank You to Imar For This Useful Post:
TangoSierra327 (January 30th, 2016)
 
Old January 30th, 2016, 06:04 PM
Registered User
 
Join Date: Jan 2016
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you, Sir. I appreciate the help!

-Tim





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic sort key components on xsl:perform-sort apollo13 XSLT 5 August 10th, 2012 03:26 PM
Dynamic sort order or sort datatype kapy_kal XSLT 2 September 18th, 2007 02:10 PM
how to sort cross tab.sort based on row total joxa83 Crystal Reports 7 March 2nd, 2006 09:12 AM
Sort @* sheila XSLT 2 July 17th, 2005 04:01 PM
Unable to sort using xsl sort command sly_jimmy_boy XSLT 3 June 17th, 2005 05:15 AM





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