C# .NET - Menu Style - Asked By Zaina . on 25-Jun-10 01:40 AM

 Hi All,

Please help I want to create a menu using accordion style in ajax.

Santhosh N replied to Zaina . on 25-Jun-10 02:11 AM

you could check this one exlainig the same

http://www.codeproject.com/KB/aspnet/accordeonmenu.aspx

Mash B replied to Zaina . on 25-Jun-10 02:28 AM

If you are looking for Accordion menu control using SiteMap, here is the one with working code


http://forums.asp.net/t/1161652.aspx


Zaina . replied to Mash B on 25-Jun-10 03:09 AM

It shows the error like

The file web.sitemap required by XmlSiteMapProvider does not exist.

Mash B replied to Zaina . on 25-Jun-10 03:19 AM
The web.sitemap file is an xml file, and must reside in the ROOT directory of your web application. The error you recieved is thrown when the web.sitemap file does not exist, or is in a location other than the root folder of the web site.
Zaina . replied to Mash B on 25-Jun-10 03:26 AM
Yes, I have added one xml file. but still gives error. Is their any need of adding one new references ?
Zaina . replied to Zaina . on 25-Jun-10 03:29 AM
I want to do, Just like the menu style(both horizontal/vertical) of codeproject website.
Mash B replied to Zaina . on 25-Jun-10 03:41 AM
Its not the normal xml file, you have to add Web.sitemap file , by right clicking on your project --> add new item --> and select Web.sitemap file
Zaina . replied to Santhosh N on 25-Jun-10 03:48 AM
I want to do, Just like the menu style(both horizontal/vertical) of codeproject website.
Devil Scorpio replied to Zaina . on 29-Jun-10 12:56 AM

Hi Zaina,


Adding Menu Items Manually

You can add individual menu items to the control by specifying them in the http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.items%28v=VS.80%29.aspx property. The Items property is a collection of MenuItem objects. The following example shows the declarative markup for a Menu control with three items, each of which has two child items:

<asp:Menu ID="Menu1" runat="server" StaticDisplayLevels="3">
  <Items>
    <asp:MenuItem Text="File" Value="File">
      <asp:MenuItem Text="New" Value="New"></asp:MenuItem>
      <asp:MenuItem Text="Open" Value="Open"></asp:MenuItem>
    </asp:MenuItem>
    <asp:MenuItem Text="Edit" Value="Edit">
      <asp:MenuItem Text="Copy" Value="Copy"></asp:MenuItem>
      <asp:MenuItem Text="Paste" Value="Paste"></asp:MenuItem>
    </asp:MenuItem>
    <asp:MenuItem Text="View" Value="View">
      <asp:MenuItem Text="Normal" Value="Normal"></asp:MenuItem>
      <asp:MenuItem Text="Preview" Value="Preview"></asp:MenuItem>
    </asp:MenuItem>
  </Items>
</asp:Menu>


Appearance and Behavior

You can adjust the behavior of the Menu control through its properties. Additionally, you can control the behavior of dynamic display, including the amount of time a menu node remains visible once it is displayed. For example, to change the Menu orientation from horizontal to vertical, you can set the http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.orientation%28v=VS.80%29.aspx property as follows:

[Visual Basic]

Menu.Orientation = Orientation.Vertical

[C#]

Menu.Orientation = Orientation.Vertical;

Setting the property to Orientation.Horizontal changes the orientation back to horizontal.

You can set individual properties of the Menu control to specify the size, color, font, and other characteristics of its appearance. In addition, you can apply skins and themes to the Menu control.

Style

Each menu level supports style properties. If no dynamic style properties are set, the static style properties are used. If dynamic style properties are set and no static style properties are set, the default rendering of static style properties is used. The Menu control style hierarchy is as follows:

  1. Control

  2. SubMenuStyles

  3. MenuItemStyles

  4. SelectedItemStyles

  5. HoverMenuItemStyles

These styles are merged across dynamic and static menus by using the following logic:

  • Each individual style is applied to the appropriate action or item type.

  • All styles are a merged into the style preceding them in the hierarchy, with the last style overriding.

For more Information please refers the following site http://msdn.microsoft.com/en-us/library/ecs0x9w5(VS.80).aspx Best Regards :)

Zaina . replied to Devil Scorpio on 29-Jun-10 01:21 AM

Yes Thank u so much Sanjay,


I have already used this in my project. And it works.