Do not use on any
shared computer
September 6, 2008 07:39pm pdt
 
[x]
Attachment Details

Help processing checked treenodes in c# ASP.NET

I have a treeview that has three tiers.

The root node represents and areas
The roots child node represents rows within the areas
And the third tier child nodes represent plots within the rows

The Treeview is checkbox enabled.

The nodes values are long integers that correlate to id fields in tables.

The nodes text fields would be hierarchically
“Area (string value)”
“Row (string value)”
“Plot (string value)”

A layout of a sample treeview might look like this for the text

Area A
      Row 1
            Plot 1
            Plot 2
      Row 2
            Plot 1
            Plot 2
Area B
      Row 1
            Plot 1
            Plot 2
 
The treeview’s node values might look like this

1
      1
            1
            2
      2
            3
            4
2
      3
            5
            6

On a button click event I need to be able to process all the nodes to capture the values of checked nodes so I can insert them into a data table associated with their appropriate values…the table would read like this
AreaID      | RowID | PlotID

1      | 1           | 1
1      | 1           | 2
1      | 2           | 3
1      | 2         | 4
2      | 3         | 5
2      | 3         | 6

That is of course assuming that each node is checked.

I can work out the code for dealing with the database itself but I am totally at a loss how to go about processing each node to determine if it is checked or not for the purpose of setting the appropriate node to its correct field.

What I mean is I need to be able to cycle through all of the nodes and depending on the hierarchical node relationship and set its value to a variable of the appropriate type to insert into the data table.

Anyone able to help me come up with the best process to do this in c#
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Programming
Question Asked By: Prysson
Solution Provided By: Prysson
Participating Experts: 1
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by QPR

Rank: Guru

Expert Comment by QPR:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by Prysson
Author Comment by Prysson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by Prysson
Accepted Solution by Prysson:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Administrative Comment by Netminder
Administrative Comment by Netminder:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Administrative Comment by modguy
Administrative Comment by modguy:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34