Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Applying a Theme to the Master page.

Applying a Theme to the Master page.

Scheduled Pinned Locked Moved ASP.NET
question
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anada8886
    wrote on last edited by
    #1

    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?

    Z A 2 Replies Last reply
    0
    • A anada8886

      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?

      Z Offline
      Z Offline
      Zafar A khan
      wrote on last edited by
      #2

      specify the Theme in web.config. no need to specify for each page including MasterPage

      <pages theme="themeName"></pages>

      A 1 Reply Last reply
      0
      • A anada8886

        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?

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        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.

        A 1 Reply Last reply
        0
        • Z Zafar A khan

          specify the Theme in web.config. no need to specify for each page including MasterPage

          <pages theme="themeName"></pages>

          A Offline
          A Offline
          anada8886
          wrote on last edited by
          #4

          Thanx for your reply. I have done the same thing & it is working also. But can't I set the theme in master page?

          A Z 2 Replies Last reply
          0
          • A Abhijit Jana

            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.

            A Offline
            A Offline
            anada8886
            wrote on last edited by
            #5

            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.

            A 1 Reply Last reply
            0
            • A anada8886

              Thanx for your reply. I have done the same thing & it is working also. But can't I set the theme in master page?

              A Offline
              A Offline
              Abhijit Jana
              wrote on last edited by
              #6

              anada8886 wrote:

              But can't I set the theme in master page?

              Apply the Theme in Page_PreInit() Event of your Default.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.

              A 1 Reply Last reply
              0
              • A anada8886

                Thanx for your reply. I have done the same thing & it is working also. But can't I set the theme in master page?

                Z Offline
                Z Offline
                Zafar A khan
                wrote on last edited by
                #7

                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.

                A 1 Reply Last reply
                0
                • A Abhijit Jana

                  anada8886 wrote:

                  But can't I set the theme in master page?

                  Apply the Theme in Page_PreInit() Event of your Default.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.

                  A Offline
                  A Offline
                  anada8886
                  wrote on last edited by
                  #8

                  Thank you sir,but I wanted it on master page so that I don't need to make changes in each and every page.

                  1 Reply Last reply
                  0
                  • Z Zafar A khan

                    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.

                    A Offline
                    A Offline
                    anada8886
                    wrote on last edited by
                    #9

                    Thank you. I wanted to know this only.

                    1 Reply Last reply
                    0
                    • A anada8886

                      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.

                      A Offline
                      A Offline
                      Abhijit Jana
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups