C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







How to Create Menus Dynamically in ASP.NET


Posted Date: 16 Jul 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms

Posted By: UltimateRengan       Member Level: Diamond
Rating:     Points: 5



This sample code creates a menu dynamically in a ASP.NET page. The code is written in VB.NET

It creates a Menu object first. Menu objects can contain other Menu objects and MenuItem objects.

To add a MenuItem to a Menu we call the Items.Add() method as shown in the example.


Dim menu As New Menu
Dim menuitem1 As New MenuItem
Dim menuitem2 As New MenuItem
menuitem1.Text = "new"
menu.Items.Add(menuitem1)
menuitem2.Text = "second"
menu.Items.Add(menuitem2)
form1.Controls.Add(menu)
Dim submenu As New MenuItem
submenu.Text = "third"
menuitem2.ChildItems.Add(submenu)




Responses

Author: Roshan R Mhatre    18 Jul 2008Member Level: Gold   Points : 2
//Create Menus Dynamically C# Coding

This sample code creates a menu dynamically in a ASP.NET page. The code is written in VB.NET
It creates a Menu object first. Menu objects can contain other Menu objects and MenuItem objects.
To add a MenuItem to a Menu we call the Items.Add() method as shown in the example.


Menu menu=new Menu();
MenuItem menuitem1 =new MenuItem();
MenuItem menuitem2 =new MenuItem();
menuitem1.Text = "new";
menu.Items.Add(menuitem1);
menuitem2.Text = "second";
menu.Items.Add(menuitem2);
form1.Controls.Add(menu);
MenuItem submenu = new MenuItem();
submenu.Text = "third";
menuitem2.ChildItems.Clear();
menuitem2.ChildItems.Add(submenu);


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
How to Create Menus Dynamically in ASP.NET  .  How to create dynamic menu using ASP.Net  .  Create Menus Dynamically in ASP.NET  .  Create Menus Dynamically  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Remoting in ASP.NET
Previous Resource: Dynamic Linkbutton using ASP.Net
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

it outsourcing

Contact Us    Privacy Policy    Terms Of Use