zoukankan      html  css  js  c++  java
  • AjAx ComponentArt. NavBar 的用法

      

           在以前我们要是想实现类似Windows XP里的NavBar 的效果,是很费劲的。现在.net环境下有了好几种可以实现这样效果的控件。在这里,我介绍一下ComponentArt. NavBar的用法.

    一.Design

          如果我们要实现的Web菜单不是动态的话,我们可以很方便的采用手动创建的方法。样式可以自己通过Css.css来样式化。

        

    效果如:
     


     

     

    2.是我要重要讲的:动态的如何来创建Web菜单:
       先说一下,我是在前一些的一个项目中,要实现下面的功能才研究的这个控件:现在那来和大家一起分享:效果如图
       

     

    所有的菜单都根据登陆者的权限来动态生成的。好了,不多说费话了。开始说如何来实现:

           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<SYS_T_Menu> 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<SYS_T_Menu> 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);

     

                    }

                }

            }

        }

    }

    如有需要的朋友,我可以将我的完整代码E_mial给他,多多指点。

  • 相关阅读:
    【Spring】的【bean】管理(XML配置文件)【Bean实例化的三种方式】
    【Spring】---【IOC入门案例】
    【Spring】---【IOC】
    DOM4J解析文件
    Hibernate API的使用(Query、Criteria、SQLQuery对象)
    Hibernate一级缓冲
    搭建Hibernate环境
    Python之路【第十六篇】:Django【基础篇】
    Python之路【第十五篇】:Web框架
    Python之路【第十四篇】:AngularJS --暂无内容-待更新
  • 原文地址:https://www.cnblogs.com/ziyan22/p/699160.html
Copyright © 2011-2022 走看看