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 April 24th, 2012, 02:12 PM
Authorized User
 
Join Date: Apr 2012
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Armaan
Default Theme

Hi Sir,
sir i have put the darkGrey and Monochrome theme in my website file according to your instruction.Now my site working well with monochrome theme but when i switched to DarkGrey theme, other setting change according to theme but the header image does not display. Even the monochrome's header image is displayed.
Sir i did not made any change to DarkGrey css file , i pasted it just from source file of this book. Please tell me what could be the possible reason.
 
Old April 24th, 2012, 02: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

Hi there,

Do you still have the styleSheetTheme set in web.config?

If that's not the case, can you post the full code for the Master Page (Markup and Code Behind), the BasePage and the page you're testing this on?

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 April 24th, 2012, 04:08 PM
Authorized User
 
Join Date: Apr 2012
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Armaan
Default Theme

Sir

I have removed the styleSheetTheme from my web.config file then total color removed from all the page even if the theme is set in the web.config.
and if both theme and styleSheetTheme is set in the web.config file then all is well for monochrome theme but the header image of DarkGrey does not display.

here is the code of my master page.
Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Frontend.master.cs" Inherits="MasterPages_Frontend" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
  <div id="PageWrapper">
    <div id="Header">
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
    </div>
    <div id="MenuWrapper">Menu Goes Here</div>
    <div id="MainContent">
      <asp:ContentPlaceHolder ID="cpMainContent" runat="server" >
        
      </asp:ContentPlaceHolder>
    </div>
    <div id="Sidebar"></div>
    <div id="Footer">Footer Goes Here</div>
  </div>
</form>
</body>
</html>
adn below is the code of MasterPage.cs

Code:
sing System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPages_Frontend : System.Web.UI.MasterPage
{
   
}
below is the BasePage code

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" || string.IsNullOrEmpty(this.Title))
    {
      throw new Exception(
            "Page title cannot be \"Untitled Page\" or an empty  string.");
    }
  }
  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);
   
  }
}

and here is the code of my default page

Code:
<%@ Page Title="Default Page" Language="C#" MasterPageFile="~/site/MasterPages/Frontend.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="site_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
  <div id="MainContent0">
    <h1 class="Introduction">
      Hi there visitor and welcome to Planet Wrox</h1>
    <p class="Introduction">
      We're glad you're paying a visit to <a href="http://www.PlanetWrox.com">
      www.PlanetWrox.com</a>, the coolest music community site on the Internet.
    </p>
    <p>
      Feel free to have a <a href="Default.aspx">look around;</a> there are lots of 
      interesting <strong>reviews and concert pictures</strong> to be found here.
    </p>
    <p>
      You can <a href="../Login.aspx">log in</a> here.</p>
  </div>
</asp:Content>
 
Old April 24th, 2012, 04:15 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Where's the code that goes in the Code Behind of the Master Page? And where is DropDownList with the themes?

Where exactly in the book did you get stuck?

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 April 25th, 2012, 01:18 AM
Authorized User
 
Join Date: Apr 2012
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Armaan
Default Theme

Sir on page 224 when in adding images to our Theme. in this exercise when i add images on monochrome theme it work will well, all the images are displayed. But in case of DarkGrey theme the header image does not display.
Here is the code of my web.config file.

Code:
<?xml version="1.0"?>
<configuration>
	<system.web>
    <pages theme="DarkGrey" styleSheetTheme="DarkGrey">
    </pages>
		<compilation debug="true" targetFramework="4.0"/>
	</system.web>
</configuration>
And below is the code of my default page.
Code:

<%@ Page Title="Default Page" Language="C#" MasterPageFile="~/site/MasterPages/Frontend.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="site_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
  <div id="MainContent0">
    <h1 class="Introduction">
      Hi there visitor and welcome to Planet Wrox</h1>
    <p class="Introduction">
      We're glad you're paying a visit to <a href="http://www.PlanetWrox.com">
      www.PlanetWrox.com</a>, the coolest music community site on the Internet.
    </p>
    <p>
      Feel free to have a <a href="Default.aspx">look around;</a> there are lots of 
      interesting <strong>reviews and concert pictures</strong> to be found here.
    </p>
    <p>
      You can <a href="../Login.aspx">log in</a> here.</p>
  </div>
</asp:Content>
and here is the code of my master page
Code:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Frontend.master.cs" Inherits="MasterPages_Frontend" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
  <div id="PageWrapper">
    <div id="Header">
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
      <br />
    </div>
    <div id="MenuWrapper">Menu Goes Here</div>
    <div id="MainContent">
      <asp:ContentPlaceHolder ID="cpMainContent" runat="server" >
        
      </asp:ContentPlaceHolder>
    </div>
    <div id="Sidebar"></div>
    <div id="Footer">Footer Goes Here</div>
  </div>
</form>
</body>
</html>
adn below is the code of MasterPage.cs

Code:
sing System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPages_Frontend : System.Web.UI.MasterPage
{
   
}
 
Old April 25th, 2012, 07:13 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,

You seem to be missing the <a> element in the header. It should be:

Code:
 
<div id=”Header”><a href=”~/” runat=”server”>Header Goes Here</a></div>

See page 200 for the full code you need to add to 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:
Armaan (April 25th, 2012)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Downloading Theme morteza ASP.NET 4 General Discussion 3 June 24th, 2010 04:51 AM
Monochrome Theme jack_hilary BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 April 18th, 2010 12:45 PM
Exception of get theme JasonF430 ASP.NET 2.0 Basics 0 April 16th, 2008 01:31 AM
Theme Selector wont pick up other theme Tawanda BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 May 4th, 2007 08:44 AM
page theme zhugeliang ASP.NET 2.0 Basics 1 January 9th, 2007 02:40 AM





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