[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 296
  • Last Modified:

Question about 4 lines of code

Hi,

I am trying to figure out what these 4 lines do:

            foreach (DataRow row in DataClass.GetCategories().Rows)
            {
                nodeParent = lstvFoodDB.Nodes.Add(row[ProductDatabase.CategoryField.Name].ToString()); <=======
                nodeParent.ImageIndex = 0;  <=======
                nodeParent.Tag = row;       <=======
                nodeParent.Nodes.Add("*");    <=======

            }

Who can tell me what this code does?

Peter
0
peterkiers
Asked:
peterkiers
2 Solutions
 
cojdevCommented:
for each loop
- a new lstvFoodDB Node is created using the CategoryFieldName
- sets the ImageIndex to 0 (no image)
- The nodes Tag property used to store a copy of the Row
- It looks sub Node is created called "*"
0
 
x77Commented:
1 -  It add a new node to lstvFoodDB.nodes collection and save it on nodeParent.
      I asume lstvFoodDB is a TreeView.
      The TreeView is asociated with a ImageList.

2 - Set the Image from ImageList to the node.

3 - Stablish nodeParent .Tag to original Row.

4 - It add a new child node to nodeParent with Text "*"

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now