/// <summary>
        /// 绑定菜单
        /// </summary>
        /// <param name="context"></param>
        public void GetLeftNavigationMenu(HttpContext context)
        {
            string callback = context.Request["jsoncallback"];
            string Roleid   = context.Request["Roleid"];

            //序列化
            System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
            DataTable     dt      = new Bll.MeetingWebBll().GetMenuInfo(Roleid);
            StringBuilder orgJson = new StringBuilder();

            DataRow[] parMenu = dt.Select("Pid=0");
            for (int i = 0; i < parMenu.Count(); i++)
            {
                orgJson.Append("<li>");
                orgJson.Append("<a class='menuclick' href='#'><i class='" + parMenu[i]["iconClass"] + "'></i>" + parMenu[i]["Name"] + "<span class='iconfont icon-icoxiala'></span></a>");
                DataRow[] subMenu = dt.Select(" Pid=" + parMenu[i]["Id"]);
                orgJson.Append("<ul class='submenu' style='display:none;'>");
                for (int j = 0; j < subMenu.Count(); j++)
                {
                    orgJson.Append("<li><a href='javascript:void(0);' data-src='" + subMenu[j]["Url"] + "'>" + subMenu[j]["Name"] + "</a></li>");
                }
                orgJson.Append("</ul>");
                orgJson.Append("</li>");
            }
            //输出Json
            context.Response.Write(callback + "({\"result\":\"" + orgJson.ToString() + "\"})");
        }
Exemplo n.º 2
0
        /// <summary>
        /// 绑定菜单
        /// </summary>
        /// <param name="context"></param>
        public void GetLeftNavigationMenu(HttpContext context)
        {
            StringBuilder orgJson = new StringBuilder();

            try
            {
                string Roleid = context.Request["Roleid"];
                //序列化

                DataTable dt = new Bll.MeetingWebBll().GetMenuInfo(Roleid);

                DataRow[] parMenu = dt.Select("Pid=0");
                for (int i = 0; i < parMenu.Count(); i++)
                {
                    orgJson.Append("<li>");
                    orgJson.Append("<a class='menuclick' href='#'><i class='" + parMenu[i]["iconClass"] + "'></i>" + parMenu[i]["Name"] + "<span class='iconfont icon-icoxiala'></span></a>");
                    DataRow[] subMenu = dt.Select(" Pid=" + parMenu[i]["Id"]);
                    orgJson.Append("<ul class='submenu' style='display:none;'>");
                    for (int j = 0; j < subMenu.Count(); j++)
                    {
                        orgJson.Append("<li><a href='javascript:void(0);' data-src='" + subMenu[j]["Url"] + "'>" + subMenu[j]["Name"] + "</a></li>");
                    }
                    orgJson.Append("</ul>");
                    orgJson.Append("</li>");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Debug(ex.Message);
            }
            finally
            {
                context.Response.Write("({\"result\":\"" + orgJson.ToString() + "\"})");
            }
            //输出Json
        }