keep a common base page for all your asp.net pages and modify the theme property between any event after PreInit
or before the Page_Load
in the base page. This will force each page to apply that theme. As in this example make MyPage as base page for all your asp.net page.
public class MyPage : System.Web.UI.Page
{
/// <summary>
/// Initializes a new instance of the Page class.
/// </summary>
public Page()
{
this.Init += new EventHandler(this.Page_Init);
}
private void Page_Init(object sender, EventArgs e)
{
try
{
this.Theme = "YourTheme"; // It can also come from AppSettings.
}
catch
{
//handle the situation gracefully.
}
}
}
//in your asp.net page code-behind
public partial class contact : MyPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}