Example #1
0
        private static void RenderPlusMinusIcon(StringBuilder html, TreeNode node)
        {
            if (node.Nodes.Count > 0)
            {
                string cssClass = "t-icon t-plus";
                if (node.Expanded)
                {
                    cssClass = "t-icon t-minus";
                }

                html.AppendFormat("<span class='{0}'></span>", cssClass);
            }
        }
Example #2
0
 private static void RenderNodeValue(StringBuilder html, TreeNode node)
 {
     if (!String.IsNullOrEmpty(node.Value))
     {
         html.AppendFormat("<input type='hidden' class='t-input' value='{0}' name='itemValue' />", node.Value);
     }
 }
Example #3
0
 private static void RenderNodeImage(StringBuilder html, TreeNode node)
 {
     if (!String.IsNullOrEmpty(node.ImageUrl))
     {
         html.AppendFormat("<img src='{0}' alt='' class='t-image' />", node.ImageUrl);
     }
 }
Example #4
0
        private static void RenderNodeDiv(StringBuilder html, TreeNode node, int index, int count)
        {
            html.Append("<div class='");

            if (index == (count - 1))
            {
                html.Append("t-bot");
            }
            else if (index == 0)
            {
                html.Append("t-top");
            }
            else
            {
                html.Append("t-mid");
            }
            html.Append("'>");

            RenderPlusMinusIcon(html, node);

            html.Append("<span class='t-in'>");
            RenderNodeImage(html, node);
            html.Append(node.Text);
            html.Append("</span>");

            RenderNodeValue(html, node);

            html.Append("</div>");
        }
Example #5
0
        private static void RenderNode(StringBuilder html, TreeNode node, int index, int count)
        {
            html.Append("<li class='t-item");

            if (index == 0)
            {
                html.Append(" t-first");
            }
            if (index == count - 1)
            {
                html.Append(" t-last");
            }

            html.Append("'>");

            RenderNodeDiv(html, node, index, count);

            if (node.Nodes.Count > 0)
            {
                html.Append("<ul class='t-group'");

                if (!node.Expanded)
                {
                    html.Append(" style='display:none'");
                }

                html.Append(">");

                for (var i = 0; i < node.Nodes.Count; i++)
                {
                    RenderNode(html, node.Nodes[i], i, node.Nodes.Count);
                }

                html.Append("</ul>");
            }

            html.Append("</li>");
        }
Example #6
0
        static void AddNode(PageItem page, TreeNode node)
        {
            foreach (var child in page.Pages)
            {
                var childNode = CreateNode(child);
                node.Nodes.Add(childNode);

                AddNode(child, childNode);
            }
        }