Abhishek
Abhishek

Reputation: 997

applying theme in asp.net

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.

Upvotes: 0

Views: 98

Answers (3)

Pranay Rana
Pranay Rana

Reputation: 176886

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;
    }
}

Upvotes: 1

Tim B James
Tim B James

Reputation: 20364

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";
}

Upvotes: 0

Ronald Wildenberg
Ronald Wildenberg

Reputation: 32094

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".

Upvotes: 0

Related Questions