protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
for (int i = 0; i < TreeView1.Nodes.Count; i++)
{
SetChildNodeText(TreeView1.Nodes[i]);
}
}
}
void SetChildNodeText(TreeNode node)
{
if (node.ChildNodes.Count > 0)
{
node.Text += ' ';
node.Text += '(' + node.ChildNodes.Count.ToString() + ')';
}
for (int i = 0; i < node.ChildNodes.Count; i++)
{
SetChildNodeText(node.ChildNodes[i]);
}
}
{
if (!this.IsPostBack)
{
for (int i = 0; i < TreeView1.Nodes.Count; i++)
{
SetChildNodeText(TreeView1.Nodes[i]);
}
}
}
void SetChildNodeText(TreeNode node)
{
if (node.ChildNodes.Count > 0)
{
node.Text += ' ';
node.Text += '(' + node.ChildNodes.Count.ToString() + ')';
}
for (int i = 0; i < node.ChildNodes.Count; i++)
{
SetChildNodeText(node.ChildNodes[i]);
}
}
No comments:
Post a Comment