Solved

HowTo: Apply theme to master AND sub-pages (VS2010 Pro)

Posted on 2010-08-12
4
810 Views
Last Modified: 2012-05-10
Greetings I am brand spanking new to VS Studio 2010 and relatively new to ASP.Net, so be gentle in your reply.

Question: I am trying to set-up a theme which is viewable on all sub-pages. In previous versions of VS, I could simply add <pages theme="myTheme" /> to the web.config file. Now in VS 2010 the web.config has been "refactored" and I cannot add that code ....so...now what?

Please advise
sleeper
0
Comment
Question by:the_sleeper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:gouber
ID: 33420948
Assuming you are doing a web project and not a windows project, you can use a master page.  Create a Site.Master file liek the following.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>My web site</title>
</head>
<body>
    <asp:ContentPlaceHolder ID="MainContent" runat="server" />
</body>
</html>

Then on each page that you create add the master file like this ...
<%@ Page Title="" Language="C#" MasterPageFile="~/LocationOfFile/Site.Master" CodeBehind="Test.aspx.cs" Inherits="YourProj.Test" %>

<asp:Content ID="Resource1" ContentPlaceHolderID="MainContent" runat="server">

Note, you can have more than one content holder in your master file.  Good luck.
0
 
LVL 1

Expert Comment

by:gouber
ID: 33421012
On a side note, if you are doing a windows app, you can create a main form that has your layout.  Then based on what you want to show, show or hide a user control in a container.  I have used a ToolStripContainer in the past.  You can put your buttons at the top in a tool strip, then show and hide user controls based on the click.  To add a user control to the tool strip container use, ToolStripContainer1.ContentPanel.Controls.Add(yourUserControl);
0
 

Author Comment

by:the_sleeper
ID: 33421123
Greetings gouber,

1. Yes, I am building a web site. But my question is about how to Apply a THEME to the MasterPage suc that all pages that DERIVE from that MasterPage can automatically apply that theme.
2. In earlier versions of VS I could simply add the following (see code block):
3. This is not available (in the web.config file) in VS 2010, so
4. My question is how to do the equivalent of item #2 in VS2010.

Hope that make the question clearer.
sleeper
<!-- this was doable in earlier versions of Visual Studio, but I cannot do this in VS 2010 as the web.config has been refactored.

So how do I still accomplish this objective in vs 2010-->


<page theme="myTheme" />

Open in new window

0
 

Accepted Solution

by:
the_sleeper earned 0 total points
ID: 33429269
OK, I figured it out. Still uses <pages theme="myTheme" />  directive in the newly re-factored web.config.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question