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. Assign themes programmatically - Master Pages

Assign themes programmatically - Master Pages

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelp
9 Posts 4 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.
  • K Offline
    K Offline
    Karan_TN
    wrote on last edited by
    #1

    Hi. currently i m using asp.net 2005 (2.0 framework). i have created 3 themes and i let the user to change the theme (using dropdownbox). below code i have used.

    const string _themeListIDKey = "_themeListIDKey";
    protected void Page_PreInit(object sender, EventArgs e)
    {
    if (IsPostBack)
    {
    string uniqueID = Request[_themeListIDKey];

            if (uniqueID != null && Request\[uniqueID\] != null)
            {
                Theme = Request\[uniqueID\];
                Session\["SelectedTheme"\] = Theme;
            }
        }
    }
    

    protected void Page_Load(object sender, EventArgs e)
    {
    ClientScript.RegisterHiddenField(_themeListIDKey, ((DropDownList)(this.Master.FindControl("DropDownList1"))).UniqueID);
    }

    but when i create a skin for gridview onload its not working. when i change another theme and again i come to the current there through dropdown, then only its applying. help me plz.... - Karan

    D A T 4 Replies Last reply
    0
    • K Karan_TN

      Hi. currently i m using asp.net 2005 (2.0 framework). i have created 3 themes and i let the user to change the theme (using dropdownbox). below code i have used.

      const string _themeListIDKey = "_themeListIDKey";
      protected void Page_PreInit(object sender, EventArgs e)
      {
      if (IsPostBack)
      {
      string uniqueID = Request[_themeListIDKey];

              if (uniqueID != null && Request\[uniqueID\] != null)
              {
                  Theme = Request\[uniqueID\];
                  Session\["SelectedTheme"\] = Theme;
              }
          }
      }
      

      protected void Page_Load(object sender, EventArgs e)
      {
      ClientScript.RegisterHiddenField(_themeListIDKey, ((DropDownList)(this.Master.FindControl("DropDownList1"))).UniqueID);
      }

      but when i create a skin for gridview onload its not working. when i change another theme and again i come to the current there through dropdown, then only its applying. help me plz.... - Karan

      D Offline
      D Offline
      daveyerwin
      wrote on last edited by
      #2

      Karan_TN wrote:

      when i create a skin for gridview onload its not working

      Do you mean Page_Load or onload in the client ? Show the code that fails.

      K 1 Reply Last reply
      0
      • K Karan_TN

        Hi. currently i m using asp.net 2005 (2.0 framework). i have created 3 themes and i let the user to change the theme (using dropdownbox). below code i have used.

        const string _themeListIDKey = "_themeListIDKey";
        protected void Page_PreInit(object sender, EventArgs e)
        {
        if (IsPostBack)
        {
        string uniqueID = Request[_themeListIDKey];

                if (uniqueID != null && Request\[uniqueID\] != null)
                {
                    Theme = Request\[uniqueID\];
                    Session\["SelectedTheme"\] = Theme;
                }
            }
        }
        

        protected void Page_Load(object sender, EventArgs e)
        {
        ClientScript.RegisterHiddenField(_themeListIDKey, ((DropDownList)(this.Master.FindControl("DropDownList1"))).UniqueID);
        }

        but when i create a skin for gridview onload its not working. when i change another theme and again i come to the current there through dropdown, then only its applying. help me plz.... - Karan

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

        Where did you applied the Themes in page ??

        Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

        K 1 Reply Last reply
        0
        • D daveyerwin

          Karan_TN wrote:

          when i create a skin for gridview onload its not working

          Do you mean Page_Load or onload in the client ? Show the code that fails.

          K Offline
          K Offline
          Karan_TN
          wrote on last edited by
          #4

          Page_PreInit

          D 1 Reply Last reply
          0
          • A Abhijit Jana

            Where did you applied the Themes in page ??

            Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

            K Offline
            K Offline
            Karan_TN
            wrote on last edited by
            #5

            i applied this coding in all pages. and the dropdown control is in master page (content area)

            A 1 Reply Last reply
            0
            • K Karan_TN

              i applied this coding in all pages. and the dropdown control is in master page (content area)

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

              Karan_TN wrote:

              i applied this coding in all pages

              Where did you used Page.Theme = currentTheme ?? Don't Apply the theme to all pages. Try to use HTTPHanlder for do the job automatically for you.

              Cheers ! Abhijit Jana | MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

              1 Reply Last reply
              0
              • K Karan_TN

                Hi. currently i m using asp.net 2005 (2.0 framework). i have created 3 themes and i let the user to change the theme (using dropdownbox). below code i have used.

                const string _themeListIDKey = "_themeListIDKey";
                protected void Page_PreInit(object sender, EventArgs e)
                {
                if (IsPostBack)
                {
                string uniqueID = Request[_themeListIDKey];

                        if (uniqueID != null && Request\[uniqueID\] != null)
                        {
                            Theme = Request\[uniqueID\];
                            Session\["SelectedTheme"\] = Theme;
                        }
                    }
                }
                

                protected void Page_Load(object sender, EventArgs e)
                {
                ClientScript.RegisterHiddenField(_themeListIDKey, ((DropDownList)(this.Master.FindControl("DropDownList1"))).UniqueID);
                }

                but when i create a skin for gridview onload its not working. when i change another theme and again i come to the current there through dropdown, then only its applying. help me plz.... - Karan

                T Offline
                T Offline
                Tej Aj
                wrote on last edited by
                #7

                Hi Karan_TN, I am preparing a tutorial to apply themes dynamically with master pages. You can have a look at it i'll let u know once its posted. Tej Aj, http://opexsolution.com/forum/[^]

                1 Reply Last reply
                0
                • K Karan_TN

                  Hi. currently i m using asp.net 2005 (2.0 framework). i have created 3 themes and i let the user to change the theme (using dropdownbox). below code i have used.

                  const string _themeListIDKey = "_themeListIDKey";
                  protected void Page_PreInit(object sender, EventArgs e)
                  {
                  if (IsPostBack)
                  {
                  string uniqueID = Request[_themeListIDKey];

                          if (uniqueID != null && Request\[uniqueID\] != null)
                          {
                              Theme = Request\[uniqueID\];
                              Session\["SelectedTheme"\] = Theme;
                          }
                      }
                  }
                  

                  protected void Page_Load(object sender, EventArgs e)
                  {
                  ClientScript.RegisterHiddenField(_themeListIDKey, ((DropDownList)(this.Master.FindControl("DropDownList1"))).UniqueID);
                  }

                  but when i create a skin for gridview onload its not working. when i change another theme and again i come to the current there through dropdown, then only its applying. help me plz.... - Karan

                  T Offline
                  T Offline
                  Tej Aj
                  wrote on last edited by
                  #8

                  Tutorial might take some time by the time you can refer this post. Check if it solves your issue. http://opexsolution.com/forum/viewtopic.php?f=15&t=28[^]

                  1 Reply Last reply
                  0
                  • K Karan_TN

                    Page_PreInit

                    D Offline
                    D Offline
                    daveyerwin
                    wrote on last edited by
                    #9

                    const string _themeListIDKey = "_themeListIDKey";
                    protected void Page_PreInit(object sender, EventArgs e)
                    {

                      if (IsPostBack)
                        {
                            string uniqueID = Request\[\_themeListIDKey\];
                            if (uniqueID != null && Request\[uniqueID\] != null)
                            {
                                Theme = Request\[uniqueID\];
                                Session\["SelectedTheme"\] = Theme;
                            }
                        }else{
                            Session\["SelectedTheme"\] = This is where you put the desired initial theme;
                        }
                    }
                    
                    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