public static System.Web.Mvc.MvcHtmlString GetButtonsForToolbar(this System.Web.Mvc.HtmlHelper htmlHelper)
 {
     StringBuilder sbBtnJs = new StringBuilder(1000);
     foreach (var button in htmlHelper.ViewBag.toolbarButtons as List<Permission>)
     {
         sbBtnJs.Append("{");
         sbBtnJs.Append("iconCls:'" + button.permissionIcon + "',");
         sbBtnJs.Append("text:'" + button.permissionName+ "',");
         sbBtnJs.Append("handler:" + button.permissionJSMethodName + "");
         sbBtnJs.Append("},'-',");
     }
     System.Web.Mvc.MvcHtmlString mvcStr = new System.Web.Mvc.MvcHtmlString(sbBtnJs.ToString());
     return mvcStr;
 }
Esempio n. 2
0
        public static System.Web.Mvc.MvcHtmlString GetButtonsForToolbar(this System.Web.Mvc.HtmlHelper htmlHelper)
        {
            StringBuilder sbBtnJs = new StringBuilder(1000);

            foreach (var button in htmlHelper.ViewBag.toolbarButtons as List <Permission> )
            {
                sbBtnJs.Append("{");
                sbBtnJs.Append("iconCls:'" + button.permissionIcon + "',");
                sbBtnJs.Append("text:'" + button.permissionName + "',");
                sbBtnJs.Append("handler:" + button.permissionJSMethodName + "");
                sbBtnJs.Append("},'-',");
            }
            System.Web.Mvc.MvcHtmlString mvcStr = new System.Web.Mvc.MvcHtmlString(sbBtnJs.ToString());
            return(mvcStr);
        }
        public static System.Web.Mvc.MvcHtmlString GetSonBtnJs(this System.Web.Mvc.HtmlHelper htmlHelper)
        {
            System.Text.StringBuilder sbBtnJs = new System.Text.StringBuilder(1000);
            var menus = htmlHelper.ViewBag.sonBtns as List <Web.EFEntity.Menu>;

            if (menus != null)
            {
                for (var i = 0; i < menus.Count(); i++)
                {
                    sbBtnJs.Append("{");
                    sbBtnJs.Append("iconCls:'" + menus[i].ToolIco + "',");
                    sbBtnJs.Append("text:'" + menus[i].MenuName + "',");
                    sbBtnJs.Append("handler:function(){" + menus[i].ActionName + "();}");
                    sbBtnJs.Append("}");
                    if (i != menus.Count() - 1)
                    {
                        sbBtnJs.Append(",'-',");
                    }
                }
            }

            System.Web.Mvc.MvcHtmlString mvcStr = new System.Web.Mvc.MvcHtmlString(sbBtnJs.ToString());
            return(mvcStr);
        }
Esempio n. 4
0
 public static string htmlAttr(this System.Web.Mvc.MvcHtmlString AntiForgeryToken, string attr = "value")
 {
     //System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex();
     return(System.Text.RegularExpressions.Regex.Replace(AntiForgeryToken.ToString().Replace("\" />", ""), "(<input[^>]*" + attr + "=\")", ""));
 }