示例#1
0
        List <MenuEx> GetMenuEx()
        {
            List <MenuEx> menuExList = new List <MenuEx>();

            for (int i = 0; i < DataGridView.Rows.Count; i++)
            {
                MenuEx menuEx = new MenuEx();
                if (((CheckBox)DataGridView.Rows[i].FindControl("chkItem")).Checked)
                {
                    string id   = ((Label)(DataGridView.Rows[i].FindControl("lblID"))).Text;
                    string name = ((TextBox)(DataGridView.Rows[i].FindControl("MenuNameTextBox"))).Text;
                    menuEx.ID       = id;
                    menuEx.MenuName = name;
                    menuExList.Add(menuEx);
                }
            }
            return(menuExList);
        }
示例#2
0
        private void frmMainMenu_Load(object sender, EventArgs e)
        {
            try
            {
                List <EapMenu> menus = Bll.GetBll().GetUserMenu(Config.GetConfig().user.USER_ID);
                if (null == menus)
                {
                    this.lblErrMsg.Text = "获取菜单失败!";
                }

                this.tlpLayout.SuspendLayout();
                var ctlMenu = new MenuEx((int)this.tlpLayout.Width, (int)(this.tlpLayout.Height * this.tlpLayout.RowStyles[1].Height / 100),
                                         menus, new EventHandler(OpenForm));
                ctlMenu.Dock   = DockStyle.Fill;
                ctlMenu.Anchor = AnchorStyles.Bottom;
                this.tlpLayout.Controls.Add(ctlMenu, 0, 1);
                this.tlpLayout.ResumeLayout();
            }
            catch (Exception ex)
            {
                this.lblErrMsg.Text = ex.Message;
            }
        }