AjAx ComponentArt. NavBar 的用法
来源:百度文库 编辑:神马文学网 时间:2024/07/05 13:52:09
在以前我们要是想实现类似Windows XP里的NavBar 的效果,是很费劲的。现在.net环境下有了好几种可以实现这样效果的控件。在这里,我介绍一下ComponentArt. NavBar的用法.
一.Design
如果我们要实现的Web菜单不是动态的话,我们可以很方便的采用手动创建的方法。样式可以自己通过Css.css来样式化。
![](http://image.360doc.cn/DownloadImg/3123/580657_1.jpg)
效果如:
![](http://image.360doc.cn/DownloadImg/3123/580657_2.jpg)
2.是我要重要讲的:动态的如何来创建Web菜单:
先说一下,我是在前一些的一个项目中,要实现下面的功能才研究的这个控件:现在那来和大家一起分享:效果如图
![](http://image.360doc.cn/DownloadImg/3123/580657_3.jpg)
所有的菜单都根据登陆者的权限来动态生成的。好了,不多说费话了。开始说如何来实现:
using System;
using ComponentArt.Web.UI;
using WySysTemWeb.Components;
using JH.WySystem.BLL.Admin;
using JH.WySystem.BOL;
using JH.WySystem.BOL.Admin;
namespace WySysTemWeb
{
public partial class SysMenu :BasePage
{
protected ComponentArt.Web.UI.NavBar serverNavBar;
protected ComponentArt.Web.UI.NavBar clientNavBar;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BuildServerNavBar();
}
}
private void BuildServerNavBar()
{
ComponentArt.Web.UI.NavBarItem newTopItem;
ComponentArt.Web.UI.NavBarItem newItem;
GenericCollection menutree = SYS_T_MenuInfo.GetTopMenu(this.CurrentUser.User_ID);
//Function_Menu menu = new Function_Menu();
foreach (SYS_T_Menu menu in menutree)
{
newTopItem = new ComponentArt.Web.UI.NavBarItem();
newTopItem.Text = menu.Menu_Name.ToString();
//父菜单左边的图标
// newTopItem.Look.LeftIconUrl = "right2.gif";
if (menu.Menu_ID == 1)
{
newTopItem.Expanded = true;
}
newTopItem.DefaultSubItemLookId = "Level2ItemLook";
//newTopItem.SubGroupCssClass = "Level2Group";
newTopItem.SelectedLookId = "TopItemLook";
serverNavBar.Items.Add(newTopItem);
GenericCollection menutreechild = SYS_T_MenuInfo.GetMenuByFatherID(menu.Menu_ID, this.CurrentUser.User_ID);
foreach (SYS_T_Menu menuchild in menutreechild)
{
newItem = new NavBarItem();
newItem.Text = menuchild.Menu_Name.ToString();
newItem.Look.LeftIconUrl = menuchild.Menu_PictureUrl.ToString();
newItem.NavigateUrl = menuchild.Menu_PageUrl.ToString();
newTopItem.Items.Add(newItem);
}
}
}
}
}
一.Design
如果我们要实现的Web菜单不是动态的话,我们可以很方便的采用手动创建的方法。样式可以自己通过Css.css来样式化。
![](http://image.360doc.cn/DownloadImg/3123/580657_1.jpg)
效果如:
![](http://image.360doc.cn/DownloadImg/3123/580657_2.jpg)
2.是我要重要讲的:动态的如何来创建Web菜单:
先说一下,我是在前一些的一个项目中,要实现下面的功能才研究的这个控件:现在那来和大家一起分享:效果如图
![](http://image.360doc.cn/DownloadImg/3123/580657_3.jpg)
所有的菜单都根据登陆者的权限来动态生成的。好了,不多说费话了。开始说如何来实现:
using System;
using ComponentArt.Web.UI;
using WySysTemWeb.Components;
using JH.WySystem.BLL.Admin;
using JH.WySystem.BOL;
using JH.WySystem.BOL.Admin;
namespace WySysTemWeb
{
public partial class SysMenu :BasePage
{
protected ComponentArt.Web.UI.NavBar serverNavBar;
protected ComponentArt.Web.UI.NavBar clientNavBar;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BuildServerNavBar();
}
}
private void BuildServerNavBar()
{
ComponentArt.Web.UI.NavBarItem newTopItem;
ComponentArt.Web.UI.NavBarItem newItem;
GenericCollection
//Function_Menu menu = new Function_Menu();
foreach (SYS_T_Menu menu in menutree)
{
newTopItem = new ComponentArt.Web.UI.NavBarItem();
newTopItem.Text = menu.Menu_Name.ToString();
//父菜单左边的图标
// newTopItem.Look.LeftIconUrl = "right2.gif";
if (menu.Menu_ID == 1)
{
newTopItem.Expanded = true;
}
newTopItem.DefaultSubItemLookId = "Level2ItemLook";
//newTopItem.SubGroupCssClass = "Level2Group";
newTopItem.SelectedLookId = "TopItemLook";
serverNavBar.Items.Add(newTopItem);
GenericCollection
foreach (SYS_T_Menu menuchild in menutreechild)
{
newItem = new NavBarItem();
newItem.Text = menuchild.Menu_Name.ToString();
newItem.Look.LeftIconUrl = menuchild.Menu_PictureUrl.ToString();
newItem.NavigateUrl = menuchild.Menu_PageUrl.ToString();
newTopItem.Items.Add(newItem);
}
}
}
}
}
AjAx ComponentArt. NavBar 的用法
ComponentArt.Web.UI.NavBar 的使用!
ScriptManager和UpdatePanel用法 (ajax) - BlueWorl...
谈AJAX的安全性及AJAX安全隐患
struts2的ajax支持,ajax校验
Ajax的优势
Ajax的竞争对手
Ajax的诞生
Ajax背后的技术
Ajax的竞争对手
Ajax,未来的WebServices?
AjAx的优缺点
AjAx的优缺点
将 Ajax 带入 Eclipse 的 Ajax Toolkit Framework 的两...
Ajax的顶级用户体验
循序渐进学习Ajax的途径
实现AJAX风格的Portal
asp简单的ajax留言板
基于AJAX的WEB设计
spring与Ajax的整合
Ajax光环背后的隐患
实现AJAX风格的Portal
asp简单的ajax留言板
Ajax 和 XML: 五个很酷的 Ajax 小部件