views:

23

answers:

3

Hello guys,

Here i want to set theme for a master page but i don't know how to do it so please tell me some solution . all the i want to do from code behind. thanks to all.

A: 

You can do this from the Page_PreInit method. Check here for more details.

You can set the theme by setting the Page.Theme property. For example, Page.Theme = "MyTheme".

Ronald Wildenberg
ya that i know but how can i set it ?
Abhisheks.net
like this this.Page.Theme = "collection"; "
Abhisheks.net
or something else ?
Abhisheks.net
A: 

vb

Protected Sub Page_PreInit(ByVal sender As Object, _
        ByVal e As System.EventArgs) Handles Me.PreInit

        Page.Theme = "ThemeName"

End Sub

c#

protected void Page_PreInit(object sender, EventArgs e)
{
    Page.Theme = "ThemeName";
}
Tim B James
+1  A: 

How to: Apply ASP.NET Themes Programmatically

protected void Page_PreInit(object sender, EventArgs e)
{
    switch (Request.QueryString["theme"])
    {
        case "Blue":
            Page.Theme = "BlueTheme";
            break;
        case "Pink":
            Page.Theme = "PinkTheme";
            break;
    }
}
Pranay Rana