Esempio n. 1
0
 protected string buildBreadcrumbs(TreeNode startingNode)
 {
     if (startingNode == null)
         return "<span class=\"breadCrumLabel\">Path</span>";
     string internalValuePath = (string)startingNode.GetType().InvokeMember("InternalValuePath", System.Reflection.BindingFlags.Default | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance, null, startingNode, null);
     string postBackUrl = this.Page.ClientScript.GetPostBackClientHyperlink(this.tv, "s" + internalValuePath, true);
     string breadcrumSeparatorImageUrl = this.getImageUrl("breadcrumseparator.gif");
     string separator = String.Format("<span class=\"breadCrumSeparator\">&nbsp;<img src=\"{0}\" alt=\">>\" title=\">>\" /> &nbsp;</span>", breadcrumSeparatorImageUrl);
     string nodeText = startingNode.Parent != null ? startingNode.Text : "Storage";
     string breadCrum;
     if (startingNode == this.tv.SelectedNode)
     {
         string template = "<span class=\"breadCrumLast\" title=\"{1}\"><img src=\"{0}\" alt=\"{1}\" title=\"{1}\" />&nbsp;{2}</span>&nbsp;";
         breadCrum = String.Format(template, startingNode.ImageUrl, Utility.QuoteJScriptString(startingNode.ToolTip, false), Utility.QuoteJScriptString(nodeText, false));
     }
     else
     {
         string template = "<a href=\"{0}\" title=\"{1}\" class=\"breadCrum\"><img src=\"{2}\" alt=\"{3}\" title=\"{3}\" />&nbsp;{4}</a>&nbsp;";
         breadCrum = String.Format(template, postBackUrl, Utility.QuoteJScriptString(startingNode.ToolTip, false), startingNode.ImageUrl, Utility.QuoteJScriptString(startingNode.ToolTip, false), Utility.QuoteJScriptString(nodeText, false));
     }
     string result = this.buildBreadcrumbs(startingNode.Parent) + separator + breadCrum;
     if (result.StartsWith(separator))
         result = result.Substring(separator.Length);
     return result;
 }
Esempio n. 2
0
        object IStateManager.SaveViewState()
        {
            object[] state   = null;
            bool     hasData = false;

            if (dirty)
            {
                if (items.Count > 0)
                {
                    hasData   = true;
                    state     = new object [items.Count + 1];
                    state [0] = true;
                    for (int n = 0; n < items.Count; n++)
                    {
                        TreeNode node = items [n] as TreeNode;
                        object   ns   = ((IStateManager)node).SaveViewState();
                        Type     type = node.GetType();
                        state [n + 1] = new Pair(type == typeof(TreeNode) ? null : type, ns);
                    }
                }
            }
            else
            {
                ArrayList list = new ArrayList();
                for (int n = 0; n < items.Count; n++)
                {
                    TreeNode node = items[n] as TreeNode;
                    object   ns   = ((IStateManager)node).SaveViewState();
                    if (ns != null)
                    {
                        hasData = true;
                        list.Add(new Pair(n, ns));
                    }
                }
                if (hasData)
                {
                    list.Insert(0, false);
                    state = list.ToArray();
                }
            }

            if (hasData)
            {
                return(state);
            }
            else
            {
                return(null);
            }
        }