The TreeView is a nice way to present a hierarchy to users, but imagine the following scenario with the hierarchy depicted below:
Building 1
-Tenant 1
- Payment 1
- Payment 2
Building 2
-Tenant 1
- Payment 1
-Tenant 2
- Payment 1
- Payment 2
where you need to do an insert to a database when the user clicks on the Payment node. Essentially the variables required for the insert are Building_Id, Tenant_Id, Payment_Id. One way to assemble these is to walk to the parent of each node:
Building_Id = Payment.ParentNode.ParentNode.Id
Is it better to store all of the values of the id's on the Payment Node in the following format, then parse the values for Building_Id, Tenant_Id, Payment_Id? For example:
Payment.Value = "1|2|1"