Click here to Skip to main content
14,733,443 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)

I have 3 themes in my App_themes . The theme will set or call in my masterpage(source code) .
<link href="../App_Themes/FCRSThemes/theme/theme2.css" rel="stylesheet" type="text/css" />

I want to set a value in web config file ie..
<add key="Theme" value="1" />

based on the key value in web config, I want set the theme in master page..

How can I do this ? and want code to write in master page.cs.... Any idea..?
Updated 23-Nov-13 22:11pm

1 solution

You can create 3 master pages with different themes and load them dynamically according to your condition on particular page is as below.

Set the master page dynamically on specific page.

protected void Page_PreInit(object sender, EventArgs e)
    if (your condition)
    this.MasterPageFile = "MasterPage.master";



For more info :select master page at run time for a specific page
aravindnass 24-Nov-13 4:16am
okk..thank you...
but any solution for my question ..? Is it possible to implement my idea ..?
Sampath Lokuge 24-Nov-13 4:23am
This is the one work around for your question.Can't you do this kind of implementation with your project ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900