You are on page 1of 1

Cmo cambiar de Theme en ASP.NET programaticamente en todo el sitio http://stackoverflow.

com/questions/3099457/how-to-change-theme-of-a-total-asp-netapplication-dynamically You can change the Theme of the page in PreInit event, but you don't have use a base page.. In masterpage create a dropdown named ddlTema, after that write this code block in your Global.asax.. See how magic works :) public class Global : System.Web.HttpApplication { protected void Application_PostMapRequestHandler(object sender, EventArgs e) { Page activePage = HttpContext.Current.Handler as Page; if (activePage == null) { return; } activePage.PreInit += (s, ea) => { string selectedTheme = HttpContext.Current.Session["SelectedTheme"] as string; if (Request.Form["ctl00$ddlTema"] != null) { HttpContext.Current.Session["SelectedTheme"] = activePage.Theme = Request.Form["ctl00$ddlTema"]; } else if (selectedTheme != null) { activePage.Theme = selectedTheme; } }; }

You might also like