示例#1
0
        private void BuildItems(TreeNodeCollection items, bool isRoot, bool isExpanded, HtmlTextWriter writer)
        {
            if (items.Count > 0)
            {
                writer.WriteLine();

                writer.WriteBeginTag("ul");

                if (isRoot)
                {
                    writer.WriteAttribute("id", Extender.MakeChildId("UL"));
                }
                if (!isExpanded)
                {
                    writer.WriteAttribute("class", "AspNet-TreeView-Hide");
                }
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Indent++;

                foreach (TreeNode item in items)
                {
                    BuildItem(item, writer);
                }

                writer.Indent--;
                writer.WriteLine();
                writer.WriteEndTag("ul");
            }
        }
示例#2
0
        protected override Object SaveAdapterViewState()
        {
            string   retStr   = "";
            TreeView treeView = Control as TreeView;

            if ((treeView != null) && (_viewState != null))
            {
                if ((_viewState != null) && (Page != null) && (Page.Form != null))
                {
                    Page.ClientScript.RegisterHiddenField(ViewStateID, _viewState);
                    string script = "document.getElementById('" + ViewStateID + "').value = GetViewState__AspNetTreeView('" + Extender.MakeChildId("UL") + "');";
                    Page.ClientScript.RegisterOnSubmitStatement(typeof(TreeViewAdapter), ViewStateID, script);
                }
                retStr = ViewStateID + "|" + ComposeViewState(treeView.Nodes, "");
            }
            return(retStr);
        }