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