Link to home
Start Free TrialLog in
Avatar of Icarion

asked on

Need different menu control for same master page, but different department pages

First off this site rocks.
We are developing a new site for county government of 25 different departments that will each have their own custom menu control (Expressions/ASPNET), but we would like to use the same master page
for all departments. So the menu will be different for each department, with same master page.  Is there a way to tell menu control to change to specific web.sitemap for each of the department home pages?
Do i place a variable in the department_home page.aspx? I dont know how to go about this. Thx.
Avatar of nathana21
Flag of United States of America image

Why not pull the menus from an xml file? Base the file contents pulled on the department number or other id.

for example

<countymenu id="12334">
<countymenu id="12232">

Open in new window

Avatar of Icarion


Hi Nathana...
Can you elaborate a little more as to what I exactly would do in the master page to call the file you mentioned above? Newbie here.
Avatar of Bob Learned
1) Create an XML file (Menu.xml in example)

2) Define a Menu instance

3) Define an XmlDataSource, pointing to the menu file

4) Example:

            <asp:Menu ID="Menu1" runat="server" DataSourceID="XmlDataSource1">
            <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Menu.xml" />

Avatar of Icarion


Ok I have a master page called  bingo.master that has
a menu instance calling on sitemap. If I use this same master
for other pages, is there a way to integrate your idea with the sitemap?
If so, can you show me how?

In addition, how would master know which menu to use when the aspx pages
are being pulled in that require different menus?

Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Icarion


Avatar of Icarion


What exactly would I place in content part of page to set the Menu control's DataSourceID in the master page?
this is the menu in master page:

<asp:Menu runat="server" id="Menu1" Font-Size="11px" Font-Names="Verdana" ShowStartingNode="false" StartingNodeOffset="0" StaticSubMenuIndent="0px" ForeColor="White" DynamicHorizontalOffset="2" Orientation="Horizontal" Font-Bold="False" DataSourceID="SiteMapDataSource2" StaticDisplayLevels="2" MaximumDynamicDisplayLevels="5">
      <StaticMenuItemStyle CssClass="menu_control" HorizontalPadding="0px" />
      <DynamicHoverStyle BackColor="#2D6EB1" ForeColor="White" />
      <DynamicMenuStyle BackColor="#01509F" HorizontalPadding="0px" />
      <StaticSelectedStyle BorderStyle="None" />
      <DynamicSelectedStyle BackColor="#1A62A9" />
      <DynamicMenuItemStyle HorizontalPadding="0px" VerticalPadding="0px" CssClass="menu_control_dynamic" />
      <StaticHoverStyle BackColor="#00509F" ForeColor="White" Font-Underline="True" Height="25px" /></asp:Menu>
        <asp:SiteMapDataSource runat="server" ID="SiteMapDataSource2">

Avatar of Icarion


Im using C# by the way.