Solved

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

Posted on 2010-08-12
4
801 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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