コード例 #1
0
        public JsonpResult _TreeViewLoading(int?ID)
        {
            int parentId = (ID == null ? 0 : (int)ID);
            var pages    = RP.GetAdminMenuRepository();

            string domain = string.Empty;

            if (!HttpContext.Request.IsLocal && SF.UseMultiDomain())
            {
                domain = "http://" + RP.GetAdminCurrentSettingsRepository().Domain;
            }

            IEnumerable nodes = pages.Where(r => r.ParentID == parentId)
                                .Select(item => new
            {
                Text           = item.Title,
                ID             = item.ID.ToString(),
                hasChildren    = (pages.Count(r2 => r2.ParentID == item.ID) > 0),
                imageUrl       = domain + Url.Content(item.Image),
                Url            = (string.IsNullOrEmpty(item.RedirectTo) ? (domain + item.Url) : item.RedirectTo),
                SpriteCssClass = "",
                expanded       = (item.IsLangRoot),
                ReportsTo      = parentId
            });

            return(this.Jsonp(nodes));
        }
コード例 #2
0
        public ActionResult _AjaxLoadingParent(string text)
        {
            var l = RP.GetAdminMenuRepository();

            return(new JsonResult {
                Data = new SelectList(l.ToList(), "ID", "Title")
            });
        }