Exemple #1
0
        public JsonResult GetChild(int id)
        {
            UrlHelper         url        = new UrlHelper(Request.RequestContext);
            SectionRepository objsection = new SectionRepository(SessionCustom);

            objsection.Entity.ParentId   = id;
            objsection.Entity.LanguageId = CurrentLanguage.LanguageId;

            IList <Section> coll = objsection.GetAllReadOnly();

            if (coll.Count > 0)
            {
                StringBuilder strb = new StringBuilder();
                strb.AppendLine("<ul style=\"display:none;\">");
                foreach (Section item in coll)
                {
                    strb.AppendLine("<li><div id='" + item.SectionId + "'><nobr><img onclick=\"expand(this, " + item.SectionId + ")\" height=\"15px\" width=\"15px\" src=\"" + url.Content("~/resources/images/25add.gif") + "\" />");
                    strb.AppendLine("<span onclick=\"ctnback.binddetail(" + item.SectionId + ")\">" + item.Name + "</span></nobr></div></li>");
                }

                strb.AppendLine("</ul>");
                return(this.Json(new { Iscontain = true, html = strb.ToString() }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(this.Json(new { Iscontain = false }, JsonRequestBehavior.AllowGet));
            }
        }