private void CreateToolBarTwinTriggerBox(sys_Action a, bool enable) { if (BaseToolBar != null && a != null) { TwinTriggerBox ttb = new TwinTriggerBox(); ttb.ID = string.Format("ttb{0}", a.ActionCode); ttb.EmptyText = "请输入搜索内容"; ttb.Trigger1Icon = TriggerIcon.Clear; ttb.Trigger2Icon = TriggerIcon.Search; ttb.Width = 200; ttb.ShowTrigger1 = false; ttb.Trigger1Click += new EventHandler(TwinTriggerBoxClick1); ttb.Trigger2Click += new EventHandler(TwinTriggerBoxClick2); if (!enable) { ttb.Text = "您没有权限操作!"; ttb.Enabled = false; } ToolbarFill tf = new ToolbarFill(); BaseToolBar.Items.Add(tf); BaseToolBar.Items.Add(ttb); } }
private void CreateToolBarButton(sys_Action a, bool enable) { if (BaseToolBar != null && a != null) { Button btn = new Button(); btn.ID = string.Format("btn{0}", a.ActionCode); var defaulttype = AuthorizationButtonType.DEFAULT; AuthorizationButtonType btnType; if (System.Enum.IsDefined(typeof(AuthorizationButtonType), a.ActionCode.ToUpper())) btnType = (AuthorizationButtonType)System.Enum.Parse(typeof(AuthorizationButtonType), a.ActionCode.ToUpper()); else btnType = defaulttype; btn.Icon = (Icon)(int)btnType; btn.Text = a.ActionName; btn.Click += new EventHandler(BtnClick); if (!enable) { btn.ToolTip = "您没有权限操作!"; btn.Enabled = false; } switch (btnType) { case AuthorizationButtonType.EXPORT: btn.EnableAjax = false; btn.DisableControlBeforePostBack = false; break; case AuthorizationButtonType.DELETE: btn.ConfirmText = "您确定要删除所选数据吗?"; break; } BaseToolBar.Items.Add(btn); } }