ASP菜单控件 [英] asp menu control

查看:76
本文介绍了ASP菜单控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想动态使用菜单控件.我将MenuName和Url放在sql数据库字段中,然后单击DynamicMenuItem,它将重定向到coressponding页面.请帮助我....

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..........

推荐答案

如果它在您的SQL数据库中,则几乎没有动态.你困在哪里?请编辑您的帖子以提供详细信息.
If it''s in your SQL database, it''s hardly that dynamic. Where are you stuck ? Please edit your post to provide detail.


将数据库的MenuName和Url获取到数据表中.
然后执行以下操作:
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);
}


这篇关于ASP菜单控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆