protected void Page_Load(object sender, EventArgs e)
 {
     if (SubjectId == 0)
         ltSubject.Text = Localization.GetString("NoSubject", LocalResourceFile);
     else
     {
         BaseHandler bh = new BaseHandler();
         var SubList = bh.GetSubjectsAsFlatList(CultureCode);
         ltSubject.Text = bh.GetSubjectString(CultureCode, SubjectId);
     }
     if (Case == EControlCase.ViewAllowEdit)
     {
         phEdit.Visible = true;
         hlEdit.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "", "edit=" + ControlOrder, AttachQS);
     }
     if (Case == EControlCase.Edit)
     {
         btnSave.Visible = true;
         btnCancel.Visible = true;
         phSelect.Visible = true;
         ltTheTree.Visible = true;
         ltTheTree.Text = "<div class=\"tree\"><div id=\"tree2\"></div></div><br />";
         BaseHandler bh = new BaseHandler();
         var tree = bh.GetSubjectsAsTree(CultureCode);
         JavaScriptSerializer TheSerializer = new JavaScriptSerializer();
         hdnTreeData.Value = TheSerializer.Serialize(tree);
     }
 }
示例#2
0
        public void BindTree(int subid)
        {
            BaseHandler objBaseHandler = new BaseHandler();
            List<Subject> SubList = (List<Subject>)objBaseHandler.GetSubjectsAsFlatList(curlan);
            string childName = SubList.Find(x => x.SubjectId == subid).label;
            int id = Convert.ToInt32(SubList.Find(x => x.SubjectId == subid).MotherId);
            while (id != 0)
            {
                Subject newSub = SubList.Find(x => x.SubjectId == id);
                childName = newSub.label + "->" + childName;
                id = Convert.ToInt32(newSub.MotherId);
            }
            lbltree.Text = LabSubjectTxt + ": " + childName;

            var tree = objBaseHandler.GetSubjectsAsTree(curlan);
            JavaScriptSerializer TheSerializer = new JavaScriptSerializer();
            hdnTreeData.Value = TheSerializer.Serialize(tree);
        }