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给他,多多指点。

  • 相关阅读:
    https://blog.csdn.net/yongchaocsdn/article/details/53355296
    P1526 [NOI2003]智破连环阵 [搜索+剪枝(二分图)]
    AT2165 Median Pyramid Hard [二分答案]
    翻煎饼 [迭代加深搜索+剪枝]
    P2962 [USACO09NOV]灯Lights [高斯消元+异或方程组 / 折半搜索]
    P5025 [SNOI2017]炸弹 [线段树优化建图 + Tarjan]
    Tarjan [割点, 缩点, 桥(待填坑)]
    线段树优化建图学习笔记
    P5468 [NOI2019]回家路线 [斜率优化dp]
    CF573E Bear and Bowling [平衡树+动态规划]
  • 原文地址:https://www.cnblogs.com/ziyan22/p/699160.html
Copyright © 2011-2022 走看看