Click here to Skip to main content
15,921,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want use a menu control dynamically.I put the MenuName and Url in my sql database field.Then i click a DynamicMenuItem it will be redirect to coressponding page.Please help me..........
Posted
Updated 10-Jan-10 18:21pm
v3

If it's in your SQL database, it's hardly that dynamic. Where are you stuck ? Please edit your post to provide detail.
 
Share this answer
 
Get the MenuName and Url from the database into a datatable.
Then do something like this:
for (int count = 0; count < datatable.Rows.Count; count++)
{
  MenuItem mnuLinkItem = new MenuItem();
  mnuLinkItem.Text = datatable.Rows[count][0].ToString();
  mnuLinkItem.NavigateUrl =  datatable.Rows[count][1].ToString();
  //let mnuMainMenu be the id of ur menu.
  mnuMainMenu.Items.Add(mnuLinkItem);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900