Reputation: 5915
I know in general themes cannot be applied to Master pages. But I was wondering there can be some trick or way to do so. In my situation I dont want to apply these to the whole site but only on an application. Because in application there are many pages I cant do it manually. In my situation I am also not able to inherit page class. Any suggestion please. This project is in Asp.net 3.5
Thanks
Upvotes: 1
Views: 4486
Reputation: 2493
You can add this code in Global.asax file:
void Application_PreRequestHandlerExecute(object src, EventArgs e)
{
Page p = this.Context.Handler as Page;
if (p != null)
{
p.PreInit += (s, ev) =>
{
DevExpress.Web.ASPxClasses.ASPxWebControl.GlobalTheme = "Aqua";
};
}
}
Upvotes: 0
Reputation: 23084
Apparently, the only way to do this programmatically if you can't inherit from a base class, is with an HTTP Module.
Check the following blog for an explanation: Set the Theme for a MasterPage (from code)
In your case you should first check the page's master page before you set the page's theme.
Upvotes: 2