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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Displaying Menus

Displaying Menus

Scheduled Pinned Locked Moved ASP.NET
csharpasp-net
3 Posts 2 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
    kiran01
    wrote on last edited by
    #1

    Hi This is Urgent, Can anyone tell me tht how should i use menu's in ASP.net application . I want only main menu's should be displayed . But when mouse pointer is taken over it , it should show me sub menus within it .And the sub menu should disappear again when pointer of mouse is taken away from main menu. If possible plz pass on the code. Thanks in Advance

    O 1 Reply Last reply
    0
    • K kiran01

      Hi This is Urgent, Can anyone tell me tht how should i use menu's in ASP.net application . I want only main menu's should be displayed . But when mouse pointer is taken over it , it should show me sub menus within it .And the sub menu should disappear again when pointer of mouse is taken away from main menu. If possible plz pass on the code. Thanks in Advance

      O Offline
      O Offline
      Omkar Ghaisas
      wrote on last edited by
      #2

      Hi, Assuming that you are using ASP.NET 2.0 framework, there's a nice Menu control provided in ASP.NET 2.0 which you can easily use for the same. Given below is the strategy and the code for the same. Table Design - CREATE TABLE [dbo].[Menu_Master] ( [Menu_ID] [int] NOT NULL , [Menu_Name] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Menu_Desc] [varchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Parent] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Sequence] [int] NOT NULL , [OnClickAction] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Roles] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Menu_Master] WITH NOCHECK ADD CONSTRAINT [PK_Menu_Master] PRIMARY KEY CLUSTERED ( [Menu_ID] ) ON [PRIMARY] GO __________________________________________________________________________ Menu populating Method - private void PopulateMenu(SqlDataReader dtMenuData, ref Menu popdownMenu) { Hashtable RootNodeReferrer = new Hashtable( ); SqlDataReader MenuData; int Counter = 0; int Level = 0; int Id = 0; MenuItem PopDownMnuItem; MenuData = dtMenuData; try { while (MenuData.Read( )) { Id = Convert.ToInt32(MenuData["Menu_ID"]); PopDownMnuItem = new MenuItem( ); if (Level == Convert.ToInt32(MenuData["Parent"])) { PopDownMnuItem.Text = MenuData["Menu_Name"].ToString( ); PopDownMnuItem.NavigateUrl = MenuData["OnClickAction"].ToString( ); PopDownMnuItem.Value = Counter.ToString( ); PopDownMnuItem.ToolTip = MenuData["Menu_Desc"].ToString( ); if (MenuData["OnClickAction"].ToString( ).Trim( ) != "") { PopDownMnuItem.Selectable = true; } else { PopDownMnuItem.Selectable = false; } if (Counter != 0) { MenuItem SepItem = new MenuItem("", "", "~\\Images\\VerMenuSep.jpg", ""); popdownMenu.Items.Add(SepItem); } popdownMenu.Items.Add(PopDownMnuItem); RootNodeReferrer.Add(Id,

      K 1 Reply Last reply
      0
      • O Omkar Ghaisas

        Hi, Assuming that you are using ASP.NET 2.0 framework, there's a nice Menu control provided in ASP.NET 2.0 which you can easily use for the same. Given below is the strategy and the code for the same. Table Design - CREATE TABLE [dbo].[Menu_Master] ( [Menu_ID] [int] NOT NULL , [Menu_Name] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [Menu_Desc] [varchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Parent] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Sequence] [int] NOT NULL , [OnClickAction] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [Roles] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Menu_Master] WITH NOCHECK ADD CONSTRAINT [PK_Menu_Master] PRIMARY KEY CLUSTERED ( [Menu_ID] ) ON [PRIMARY] GO __________________________________________________________________________ Menu populating Method - private void PopulateMenu(SqlDataReader dtMenuData, ref Menu popdownMenu) { Hashtable RootNodeReferrer = new Hashtable( ); SqlDataReader MenuData; int Counter = 0; int Level = 0; int Id = 0; MenuItem PopDownMnuItem; MenuData = dtMenuData; try { while (MenuData.Read( )) { Id = Convert.ToInt32(MenuData["Menu_ID"]); PopDownMnuItem = new MenuItem( ); if (Level == Convert.ToInt32(MenuData["Parent"])) { PopDownMnuItem.Text = MenuData["Menu_Name"].ToString( ); PopDownMnuItem.NavigateUrl = MenuData["OnClickAction"].ToString( ); PopDownMnuItem.Value = Counter.ToString( ); PopDownMnuItem.ToolTip = MenuData["Menu_Desc"].ToString( ); if (MenuData["OnClickAction"].ToString( ).Trim( ) != "") { PopDownMnuItem.Selectable = true; } else { PopDownMnuItem.Selectable = false; } if (Counter != 0) { MenuItem SepItem = new MenuItem("", "", "~\\Images\\VerMenuSep.jpg", ""); popdownMenu.Items.Add(SepItem); } popdownMenu.Items.Add(PopDownMnuItem); RootNodeReferrer.Add(Id,

        K Offline
        K Offline
        kiran01
        wrote on last edited by
        #3

        Thanks a lot

        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