Tuesday, December 30, 2008

How To Create Menu Dynamically With Child Elements

protected void Page_Load(object sender,  EventArgs e)
{

Menu
myMenu = new Menu();
this.form1.Controls.Add(myMenu);
MenuItem mnItem = new MenuItem("Dyamnic Menu");
myMenu.Items.Add(mnItem);


MenuItem menuNodeChild = new MenuItem("Xploredotnet");
mnItem.ChildItems.Add(menuNodeChild);
menuNodeChild.NavigateUrl =
"http://www.Xploredotnet.com";
menuNodeChild = new
MenuItem("ASP.NET");
mnItem.ChildItems.Add(menuNodeChild);
menuNodeChild.NavigateUrl =
"http://www.asp.net";


myMenu.Orientation =
Orientation.Horizontal;
//myMenu .Orientation = Orientation.Vertical;
}


No comments:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.