Applying a Theme to the Master page.
-
Hello everyone, Can anybody please tell me,what is the proper way of applying a theme to the Master page. Instead of setting the theme attribute of every page ,I did it by writing
<pages theme="Theme"></pages>
in the web.config & it worked fine, but I want to use theme in master page.Any suggestions?
-
Hello everyone, Can anybody please tell me,what is the proper way of applying a theme to the Master page. Instead of setting the theme attribute of every page ,I did it by writing
<pages theme="Theme"></pages>
in the web.config & it worked fine, but I want to use theme in master page.Any suggestions?
specify the Theme in web.config. no need to specify for each page including MasterPage
<pages theme="themeName"></pages>
-
Hello everyone, Can anybody please tell me,what is the proper way of applying a theme to the Master page. Instead of setting the theme attribute of every page ,I did it by writing
<pages theme="Theme"></pages>
in the web.config & it worked fine, but I want to use theme in master page.Any suggestions?
anada8886 wrote:
but I want to use theme in master page.Any suggestions?
Why? you want to change theme at runtime?
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
specify the Theme in web.config. no need to specify for each page including MasterPage
<pages theme="themeName"></pages>
-
anada8886 wrote:
but I want to use theme in master page.Any suggestions?
Why? you want to change theme at runtime?
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Thanx for your reply. I have done the same thing & it is working also. But can't I set the theme in master page?
anada8886 wrote:
But can't I set the theme in master page?
Apply the Theme in
Page_PreInit(
) Event of yourDefault.aspx (Home)
Page.protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "Theme1";
}Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Thanx for your reply. I have done the same thing & it is working also. But can't I set the theme in master page?
No you can not specify a theme in master page . if you don't to specify a theme in web.config then you have to specify in each page for which you want to apply them.
-
anada8886 wrote:
But can't I set the theme in master page?
Apply the Theme in
Page_PreInit(
) Event of yourDefault.aspx (Home)
Page.protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "Theme1";
}Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
No you can not specify a theme in master page . if you don't to specify a theme in web.config then you have to specify in each page for which you want to apply them.
-
Actually, I tried on the aspx page and it was working but it's not feasible to set this for every page. So, I wanted to know if I can set the theme using master page. Well, Thanx for your reply.
anada8886 wrote:
I tried on the aspx page and it was working but it's not feasible to set this for every page.
Then what is the problem with use web.config to set the Theme. There are three way to apply the theme in your application. 1.
// Applying theme to a particular page
<%@ Page Theme="ThemeName" Language="C#"%>
// Applying theme to a particular page
protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "ThemeName";
}3. In web.config
//Apply theme to all over the web aplication
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.