Example #1
0
 public static void SetGridBatchActionConfirm(
     Grid grid, FineUI.MenuButton btn,
     string actionName         = "删除",
     string confirmTemplate    = "确定要{0}选中的<span><script>{1}</script></span>项记录吗?",
     string noSelectionMessage = "请至少应该选择一条记录!"
     )
 {
     btn.OnClientClick = grid.GetNoSelectionAlertInParentReference(noSelectionMessage);
     btn.ConfirmText   = String.Format(confirmTemplate, actionName, grid.GetSelectedCountReference());
     btn.ConfirmTarget = FineUI.Target.Top;
 }
Example #2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            // 工具栏上的帮助菜单
            JArray ja = JArray.Parse(ConfigHelper.HelpList);
            foreach (JObject jo in ja)
            {
                MenuButton menuItem = new MenuButton();
                menuItem.EnablePostBack = false;
                menuItem.Text = jo.Value<string>("Text");
                menuItem.Icon = IconHelper.String2Icon(jo.Value<string>("Icon"), true);
                menuItem.OnClientClick = String.Format("addExampleTab('{0}','{1}','{2}')", jo.Value<string>("ID"), ResolveUrl(jo.Value<string>("URL")), jo.Value<string>("Text"));

                btnHelp.Menu.Items.Add(menuItem);
            }

            // 用户可见的菜单列表
            List<Menu> menus = ResolveUserMenuList();
            if (menus.Count == 0)
            {
                Response.Write("系统管理员尚未给你配置菜单!");
                Response.End();

                return;
            }

            // 注册客户端脚本,服务器端控件ID和客户端ID的映射关系
            JObject ids = GetClientIDS(regionPanel, regionTop, btnShowHideHeader, mainTabStrip, txtUser,
                txtOnlineUserCount, txtCurrentTime, btnRefresh);
            ids.Add("userName", GetIdentityName());
            ids.Add("userIP", Request.UserHostAddress);
            ids.Add("onlineUserCount", GetOnlineCount());

            if (ConfigHelper.MenuType == "accordion")
            {
                Accordion accordionMenu = InitAccordionMenu(menus);
                ids.Add("treeMenu", accordionMenu.ClientID);
                ids.Add("menuType", "accordion");
            }
            else
            {
                Tree treeMenu = InitTreeMenu(menus);
                ids.Add("treeMenu", treeMenu.ClientID);
                ids.Add("menuType", "menu");
            }

            string idsScriptStr = String.Format("window.DATA={0};", ids.ToString(Newtonsoft.Json.Formatting.None));
            PageContext.RegisterStartupScript(idsScriptStr);
        }
Example #3
0
 private void ResolveEnableStatusButtonForGrid(MenuButton btn, Grid grid, bool enabled)
 {
     string enabledStr = "启用";
     if (!enabled)
     {
         enabledStr = "禁用";
     }
     btn.OnClientClick = grid.GetNoSelectionAlertInParentReference("请至少应该选择一项记录!");
     btn.ConfirmText = String.Format("确定要{1}选中的<span class=\"highlight\"><script>{0}</script></span>项记录吗?", grid.GetSelectedCountReference(), enabledStr);
     btn.ConfirmTarget = FineUI.Target.Top;
 }
Example #4
0
 private void SetSelectedMenuID(MenuButton menuButton, string selectedMenuID)
 {
     foreach (FineUI.MenuItem item in menuButton.Menu.Items)
     {
         MenuCheckBox menu = (item as MenuCheckBox);
         if (menu != null && menu.ID == selectedMenuID)
         {
             menu.Checked = true;
         }
         else
         {
             menu.Checked = false;
         }
     }
 }
Example #5
0
 private string GetSelectedMenuID(MenuButton menuButton)
 {
     foreach (FineUI.MenuItem item in menuButton.Menu.Items)
     {
         if (item is MenuCheckBox && (item as MenuCheckBox).Checked)
         {
             return item.ID;
         }
     }
     return null;
 }