473,396 Members | 2,108 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.

Tree View

Hi,

I designed one treeview in asp.net

my treeview looks like

-level1
- A
- B
-level2
- C
- D

At startup I only see the root levels
- level 1
- level 2

I expand level 1 and click level2
then a postback is generated and the tree is rebuilt. This is a problem
because after the postback the state of the tree is forgotton.
Meaning it is back to
- level 1
- level 2

instead of
-level1
- A
- B
-level2


I want a way for the treeview to remember which nodes should be expanded and not.. All this
is forgotten when I rebulid my tree.

Anyone know how to fix this?
Jul 3 '08 #1
3 944
DrBunchman
979 Expert 512MB
It should maintain it's state across postbacks.

Can you print the aspx code for your tree and the .vb/c# code you're using to build the tree please.

Dr B
Jul 3 '08 #2
Expand|Select|Wrap|Line Numbers
  1.  
  2.  Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
  3. new_dbconn1.ConnectionString = ConfigurationManager.ConnectionStrings("database name").ConnectionString
  4. AMenu.Access_Menu(Session("form")) 
  5. If Not IsPostBack Then
  6. PopulateRootLevel()
  7. MyTree.CollapseAll()
  8. End If
  9. _titleiconimageurl = "~/images/menuicon.jpg"
  10. End Sub
  11.  
  12. <asp:TreeView ID="MyTree" runat="server" OnTreeNodePopulate="MyTree_TreeNodePopulate" CollapseImageToolTip="" ExpandImageToolTip="" NodeStyle-ForeColor="DarkBlue"
  13. SkinID ="MSDN" > 
  14. </asp:TreeView>
  15.  
Jul 3 '08 #3
DrBunchman
979 Expert 512MB
If you put a breakpoint on the MyTree.CollapseAll() line in your Page_Load Sub does it hit this when you do a postback?

Do you invoke the CollapseAll() method anywhere else in your code which could be causing this?

Dr B

PS Please remember to surround all code in your posts with code tags using the # button at the top of the editor window - it makes your posts much easier to read. Thanks.
Jul 3 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: imani_technology_spam | last post by:
We need to present hierarchical data on a web page, the same way the tree view shows files in Windows Explorer. Here's the catch: that tree view needs to be bound to a SQL Server database. How...
0
by: Tree menu using XML | last post by:
I have one XML file that has nodes and sub node and each and every node has the attribute call visible if its value is true then diplay this node else don't display thid node, but this condition i...
1
by: Jesper DK | last post by:
Hi, I have docked a tree view to the left on a form. When I start to populate this tree view with nodes, a horizontal scroll box appears in the bottom of the tree view even though thee tree...
3
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an...
1
by: Kaye | last post by:
It seems that when I dynamically resize items in a tree-view control, using TVM_SETITEM and the TVITEMEX iIntegral member, things go awry. The window draws properly, but it seems like the RECTs for...
10
by: dwok | last post by:
Does anyone know of a good article that discusses creating a "Tree View" control in ASP.NET? Or perhaps a Tree View Control that comes with source code? I have come across a lot of tree controls...
0
by: rinishrk | last post by:
Hi, I have a web application that contains subfolders Admin and User with related webpages inside them. Within the Admin folder I have a page containing a Tree View Control.I want this tree view...
3
by: gmail | last post by:
Hi Friends, Can any body suggest me on this. I am working on .NET 2005 Frame work 2.0 . I am facing problem using the tree stucture. I created the site map.Now i want use the site map in every...
1
by: BeginingOfLife | last post by:
i am using a java script to create a tree view in my html page. i got that script from this link : http://destroydrop.com/javascripts/tree/ given script is static script creations for tree...
1
by: happy.john1234 | last post by:
Hi, i have got large xml file which i have to show in tree view windows form.I tried with loading all those data at once to tree view but it took a long time to render that tree view.Now i am...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.