Changing bgcolor in Master Page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suganya
    New Member
    • Dec 2006
    • 39

    #1

    Changing bgcolor in Master Page

    Hi

    I have a master page with <TD> columns defined in the table as <td bgcolor="#51864 3"> (which means bgcolor="green" ). In one of my content pages, I have a dropdown with values such as blue, green. In that, if I select the value as blue, then all <TD>'s in Master page with bgcolor="#51864 3" should change as green. So that the use can customize their page according to their color selection.
  • xend
    New Member
    • Sep 2008
    • 8

    #2
    Make a method in the master page class that receives a color and then changes the tds bgcolor (td probably must be runnat="server" ). Then in the content page call that method of the masterpage.

    void Page_Load(objec t sender, EventArgs e) //content page load event
    {
    Master.changeTD Color(Color);// changeTDColor is the method created in the master page.
    }

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      The problem is that what you set won't persist. You might be able to change it for one page load, but the next page you load, it will load the default master page. What you need to do is use cookies.

      When a user selects a color, save that color to a cookie. And in your master page's Page_Load method, check for that cookie. If it exists, get the color from it and use it as the bgcolor (although using CSS is preferable now), otherwise, use a default color.

      Comment

      Working...