Hello
This is related to the "Try it out" on page 226
I am currently trying to apply the second theme "Dark Grey" as the default theme is Monochrome. I followed the steps, made the changes in the BasePage in the App_Code folder saved all changes, and opened the page. But I cannot apply the "Dark Grey" theme as it still refreshes with Monochrome. I have a feeling I somehow inserted the code incorrectly or in the wrong order. I will insert the code below.
PHP Code:
using System;
using System.Web;
public class BasePage : System.Web.UI.Page
{
private void Page_PreRender(object sender, EventArgs e)
{
if (this.Title == "Untitled Page")
{
throw new Exception("Page title cannot be \"Untitled Page\".");
}
}
private void Page_PreInit(object sender, EventArgs e)
{
HttpCookie preferredTheme = Request.Cookies.Get("PreferredTheme");
if (preferredTheme != null)
{
Page.Theme = preferredTheme.Value;
}
}
public BasePage()
{
this.PreRender += new EventHandler(Page_PreRender);
this.PreInit += new EventHandler(Page_PreInit);
}
}
Sorry for the trouble
*edit*
Problem solved. It was a typo on the code behind the drop down menu on the BasePage as shown below...
PHP Code:
HttpCookie preferredTheme = new HttpCookie("PreferredThene");
Silly me >_>