Set the CSS-friendly menu properties programmatically RRS feed

  • Question

  • User647540711 posted

    We use a single master page for three website "sections" but we want to the menu color scheme to change depending on the section. Would skins be the way to go and does the CSS-friendly menu play well with skins?  Is it possible to set the CSS-friendly menu properties programmatically? Seems like a lot of work to change menu item background colors but I like the look of what our designer proposed.

    Tuesday, April 1, 2008 4:30 PM


  • User647540711 posted

    Came up with a solution. Based on the number of views this post has generated there doesn't seem to be much interest so I won't go into great detail. Post a response if you want me to expand on the solution.

    The objective:

    The menu control colors need to change based on the web section. Nested master pages won't work because of the menu placement.

    The challenge:

    Because it is not part of the framework we can't set CssSelectorClass in code behind.

    The solution:

    Created a simple menu class that allows me to pass the page category field value from the content page code behind.

    Created a menu user control which contains the four menu controls. The user control code behind has a switch statement that sets the menu control visibility to true based on the page category value it gets from the menu class.

    Incorporated the menu user control into the master page. All menu maintenance is now managed in the user control.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 3, 2008 10:18 AM