File: populate.cs

package info (click to toggle)
xsp 2.10-2.4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,656 kB
  • sloc: cs: 11,307; xml: 8,481; sh: 4,378; perl: 1,189; makefile: 744; php: 6
file content (37 lines) | stat: -rwxr-xr-x 899 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public class Populate: Page
{
    public void TreeView1_TreeNodePopulate(object sender, TreeNodeEventArgs e)
    {
        if (e.Node.Depth > 4)
			return;

        for (int n = 0; n < (e.Node.Depth+1) * 2; n++)
        {
			string label = string.Empty;
			if (e.Node.Depth < 1) 
				label = "Node";
			else
				label = e.Node.Text;
	
			if (Char.IsDigit(label.ToCharArray()[label.Length-1])) {
				label += " " + (char)(n + 65);
			} else {
				label += " " + n;

			}
			TreeNode nod = new TreeNode(label);
            //TreeNode nod = new TreeNode("Node " + e.Node.Depth + " " + n);
            nod.PopulateOnDemand = true;
            e.Node.ChildNodes.Add(nod);
        }
    }

}