473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

the best way to remember all of a TreeView's node's collapsed stat

I would like to remember the state of the nodes after the treeview gets
disposed, but not necessarily after the app terminates so I don't need a disk
file. I was thinking about using the tag property, but I am already using it,
so then I though about making a custom treeiew using inheritance and adding
another tag type property? Any clues?
kevin
Nov 21 '05 #1
2 2657
"kevin" <ke***@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
I would like to remember the state of the nodes after the treeview gets
disposed, but not necessarily after the app terminates so I don't need a
disk
file. I was thinking about using the tag property, but I am already using
it,
so then I though about making a custom treeiew using inheritance and
adding
another tag type property? Any clues?
kevin

So, what you are looking for is something that can reside in memory that can
store a treeview-like structure along with the collapsed stated of each
node? If so, why not just use the actual TreeView object itself? You
mention the TreeView getting disposed, but if you want to "remember" the
node hierarchy and the collapsed states, why not just copy the instance of
the TreeView in question to a variable that can be accessed by whatever
component which needs to do the "remembering"? You'd not only have the
entire hierarchy and the collapsed states, but *all* of the original
properties that you'd previously set, including your custom Tag values.

- Mitchell S. Honnert

PS: Here's some unsolicited advice. :-) Personally, I avoid using the Tag
property as all costs. You mention extending the TreeView node class using
inheritence and this is exactly what I would do (and have done) when I need
to add a custom property to a node. I don't know if you have other people
which might have to maintain your code, but *you* may know that the Tag
property is (for example) used to store a single character code which
represents the type of node, but someone else wouldn't know just by looking
at the value. But if you extended the TreeView node and added your own
custom, enumerated NodeType property, there'd be no doubt about the purpose
of the property.
Nov 21 '05 #2
Mitchell S. Honnert wrote:
"kevin" <ke***@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.com...
I would like to remember the state of the nodes after the treeview gets
disposed, but not necessarily after the app terminates so I don't need a
disk
file. I was thinking about using the tag property, but I am already using
it,
so then I though about making a custom treeiew using inheritance and
adding
another tag type property? Any clues?
kevin


So, what you are looking for is something that can reside in memory that can
store a treeview-like structure along with the collapsed stated of each
node? If so, why not just use the actual TreeView object itself? You
mention the TreeView getting disposed, but if you want to "remember" the
node hierarchy and the collapsed states, why not just copy the instance of
the TreeView in question to a variable that can be accessed by whatever
component which needs to do the "remembering"? You'd not only have the
entire hierarchy and the collapsed states, but *all* of the original
properties that you'd previously set, including your custom Tag values.

- Mitchell S. Honnert

PS: Here's some unsolicited advice. :-) Personally, I avoid using the Tag
property as all costs. You mention extending the TreeView node class using
inheritence and this is exactly what I would do (and have done) when I need
to add a custom property to a node. I don't know if you have other people
which might have to maintain your code, but *you* may know that the Tag
property is (for example) used to store a single character code which
represents the type of node, but someone else wouldn't know just by looking
at the value. But if you extended the TreeView node and added your own
custom, enumerated NodeType property, there'd be no doubt about the purpose
of the property.

thanks Mitchell,
I would agree that using the tag property can be confusing, but if it is
used consistently throughout the code and is well documented I don't
really see a problem (it may even be easier than creating a custom
control for just a single addition property) However by iheriting the
treeview class, it become easy to add whatever custom properties are
needed, then using the tag property becomes a hassle.
thanks for your input
kevin
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Edwin Knoppert | last post by:
I'm using a simple treeview for helpsystem. The treeview is on a masterpage, right beside it it has the container. The user uses the treeview to navigate to helppages using this masterpage. But on...
0
by: Edwin Knoppert | last post by:
I'm using a simple treeview for helpsystem. The treeview is on a masterpage, right beside it it has the container. The user uses the treeview to navigate to helppages using this masterpage. But on...
2
by: Sam | last post by:
Hi, Say I have the following Treeview : N1 |-N11 |-N12 |-N121 |-N122 N2 |-N21
1
by: Alex D. | last post by:
hey guys I found what is causing the problems with my treeview in Firefox...the answer is: treeview+dropdwonlist in the same page dont work! try this simple code and see for yourselves. you can do...
3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
1
by: James Coleman | last post by:
I am using the TreeView control in ASP.NET 2.0 and like it. However, our sitebuilders aren't too pleased with the idea of the table that gets rendered. They are big into avoiding <table> tags...
2
by: Claus | last post by:
Hello, I have a long treeview with scrollbars. When I scroll down and press a treeview node, then the Load event fires and navigate in an iframe to another page. The problem is, that afterwards...
4
by: frostbb | last post by:
I have a C# WinForms treeview with 20 or so 'level 0' nodes. My users will normally have 2 of the 'level 0' branches open down to a '5th level' selected node. The users will make updates to...
0
by: ton | last post by:
Hi, In my website the treeview is placed in the update panel of AJAX. Clicking on the nodes, the server side code is getting the childnotes and shows the details on the right site of the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.