473,397 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

ASP.NET 2.0 - Can I easily control the master page from the Profil

I want to allow users to choose the look of my site. I am controlling the
look using master pages. I have 2 master pages to choose from. I want to
store and control the user's choice using the Profile stuff in 2.0. I can do
it by setting the master page in the code of each page to a value in the
Profile, but I was wondering if there is something simpler built in that I am
missing. Thanks.
Nov 19 '05 #1
6 1066
How about themes?

"lanem" wrote:
I want to allow users to choose the look of my site. I am controlling the
look using master pages. I have 2 master pages to choose from. I want to
store and control the user's choice using the Profile stuff in 2.0. I can do
it by setting the master page in the code of each page to a value in the
Profile, but I was wondering if there is something simpler built in that I am
missing. Thanks.

Nov 19 '05 #2
In this case I just want to set the master page per user.

"Siva M" wrote:
How about themes?

"lanem" wrote:
I want to allow users to choose the look of my site. I am controlling the
look using master pages. I have 2 master pages to choose from. I want to
store and control the user's choice using the Profile stuff in 2.0. I can do
it by setting the master page in the code of each page to a value in the
Profile, but I was wondering if there is something simpler built in that I am
missing. Thanks.

Nov 19 '05 #3
You could derive all of your pages from a base class, which can use
the PreInit event to set the master page.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 6 Oct 2005 10:16:03 -0700, "lanem"
<la***@discussions.microsoft.com> wrote:
I want to allow users to choose the look of my site. I am controlling the
look using master pages. I have 2 master pages to choose from. I want to
store and control the user's choice using the Profile stuff in 2.0. I can do
it by setting the master page in the code of each page to a value in the
Profile, but I was wondering if there is something simpler built in that I am
missing. Thanks.


Nov 19 '05 #4
Sorry to ask. But, how do I derive all of my pages from a base class? Thaknn.

"Scott Allen" wrote:
You could derive all of your pages from a base class, which can use
the PreInit event to set the master page.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 6 Oct 2005 10:16:03 -0700, "lanem"
<la***@discussions.microsoft.com> wrote:
I want to allow users to choose the look of my site. I am controlling the
look using master pages. I have 2 master pages to choose from. I want to
store and control the user's choice using the Profile stuff in 2.0. I can do
it by setting the master page in the code of each page to a value in the
Profile, but I was wondering if there is something simpler built in that I am
missing. Thanks.


Nov 19 '05 #5
Create a class file like this:

namespace WebApplication4 //or whatever
{
public class MyPage : System.Web.UI.Page
{
public string name = "neil";
}
}

your web.config should have a <pages> section like this:

<configuration>
<system.web>
<pages pageBaseType="WebApplication4.MyPage,WebApplicatio n4" />
</system.web>
</configuration>

this is for non code behind

in your codebehind pages, you'd change this:

public class WebForm2 : System.Web.UI.Page
{
....
}

to this
public class WebForm2 : WebApplication4.MyPage
{
....
}

cheers

Nov 19 '05 #6
(that's actually 1.1 info)

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Developer in California | last post by:
I am working on developing a generic Web framework using Master Pages in ASP.NET 2.0. What I have done is created a PageRenderer class which has a public method which will retrieve the path of the...
13
by: Michael | last post by:
I have setup a public variable in the Master Page "code-behind-file". Now I would like to set that value from the UserControl, but I can't seem to find a way to do this. Does anyone have any ideas?...
3
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property...
4
by: Boris Yeltsin | last post by:
OK, on my Master Page I have a control: <a id="hypTabAccount" href="#" runat="server">Account</a> Now, in the code-behind (Root.master.vb) I can refer to it simply thus: ...
3
by: Griff | last post by:
I want to build a set of compiled user controls to incorporate into a web site. The majority of user controls will be placed on specific web page and these controls would share a common...
1
by: thejackofall | last post by:
I can use a good help here with what looks like a simple problem. I have a control called Header.ascx in /Control/System directory, where / is my web application directory. The header is used...
0
by: robgallen | last post by:
I have 2 user controls within a master page, and I would like one of them to call a function in the other. All the examples I have seen involve a page communicating with the Master page, or with...
4
by: Torben Laursen | last post by:
I want to change the label of a component that I have on a masterpage but I cannot get my hands on it I have a mastepage MP2 that has a button called B2 masterpage MP2 uses masterpage MP1 that has...
5
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm trying to make my code as streamlined as possible, and add CSS file references dynamically when they are required, for example, if a page contains a webcontrol, then the related CSS...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.