Solved

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

Posted on 2010-08-12
4
769 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
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:gouber
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
OK, I figured it out. Still uses <pages theme="myTheme" />  directive in the newly re-factored web.config.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now