I find this link vey useful :
http://www.codeproject.com/Articles/18300/How-to-change-page-theme-in-asp-net-2-0-dynamicall
I added themes : As White , Yellow and Red In my Project .
To add theme :
<asp:button runat="server" xmlns:asp="#unknown">
BackColor="White"
ForeColor="Black"
Font-Name="Times New Roman"
Font-Size="12px" />
<asp:button runat="server">
BackColor="Red"
ForeColor="Green"
Font-Name="Arial Black"
Font-Size="12px" />
<asp:button runat="server">
BackColor="Yellow"
ForeColor="Orange"
Font-Name="Comic Sans MS"
Font-Size="12px" />
</asp:button></asp:button></asp:button>
I have taken two buttons for Yellow and Red Theme and a label to Display message . Code is as below
<pre lang="HTML">
<asp:button id="btnYellowTheme" runat="server" text="Yellow Theme" style="position :absolute ; left: 76px; top: 74px;" onclick="btnYellowTheme_Click" xmlns:asp="#unknown" />
<asp:button id="btnRedTheme" runat="server" text="Red Theme" style="position :absolute ; left: 225px; top: 74px;" height="24px" onclick="btnRedTheme_Click" xmlns:asp="#unknown" />
<asp:label id="lblDisplay" runat="server" text="" style="position :absolute; left: 135px; top: 34px;" xmlns:asp="#unknown"></asp:label>
For Coding Part , to apply theme dynamically :
public partial class _Default : System.Web.UI.Page
{
string thmName;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Page_PreInit(Object sender, EventArgs e)
{
thmName = (string)Session["ThemeName"];
if (thmName != null)
{
Page.Theme = thmName;
lblDisplay.Text = "You have applied Theme :" + (string)Session ["ThemeName"];
}
else
{
thmName = "White";
Page.Theme = thmName;
lblDisplay.Text = "This is default White Theme";
}
}
protected void btnYellowTheme_Click(object sender, EventArgs e)
{
thmName = "Yellow";
Session["ThemeName"] = thmName;
Session["ThemeName"] = "Yellow";
Server.Transfer(Request.FilePath);
}
protected void btnRedTheme_Click(object sender, EventArgs e)
{
thmName = "Red";
Session["ThemeName"] = thmName;
Response.Redirect("Default.aspx");
Session["ThemeName"] = "Red";
Server.Transfer(Request.FilePath);
}
}
<pre lang="text">
Thank You