473,769 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

make TreeView stay at top

I have a TreeView control that I am populating with a lot of data.

I have been asked to expand the nodes so management can quickly access the
individual elements.

This is easy to do with TreeView1.Expan dAll(); however, the TreeView control
scrolls the last part of the data into focus.

How do I either prevent this scrolling or reset the TreeView control's view?
Sep 17 '08 #1
3 6047
Found a quick fix already:

After TreeView1.Expan dAll(),
set TreeView1.TopNo de = TreeView1.Nodes[0];

If there is something better (or other ideas), I always enjoy hearing them!

"jp2msft" wrote:
I have a TreeView control that I am populating with a lot of data.

I have been asked to expand the nodes so management can quickly access the
individual elements.

This is easy to do with TreeView1.Expan dAll(); however, the TreeView control
scrolls the last part of the data into focus.

How do I either prevent this scrolling or reset the TreeView control's view?
Sep 17 '08 #2
jp2msft avait prétendu :
I have a TreeView control that I am populating with a lot of data.

I have been asked to expand the nodes so management can quickly access the
individual elements.

This is easy to do with TreeView1.Expan dAll(); however, the TreeView control
scrolls the last part of the data into focus.

How do I either prevent this scrolling or reset the TreeView control's view?
Hi jp2msft,

By default, TreeView control doesn't focus last tree node. Perhaps, you
make something that makes this behavior.

To prevent scrolling you can insert javascript like this at the bottom
your page :
<script>
window.scroll(0 ,0);
</script>

--
Paul Musso
Sep 17 '08 #3
Well... I forgot to say that this is a WinForm and not a WebForm, so I don't
use JavaScript. I suppose what you gave was still an answer, though.

I was able to get "TreeView1.TopN ode = TreeView1.Nodes[0];" to work for me,
though.

"Paul Musso" wrote:
jp2msft avait prétendu :
I have a TreeView control that I am populating with a lot of data.

I have been asked to expand the nodes so management can quickly access the
individual elements.

This is easy to do with TreeView1.Expan dAll(); however, the TreeView control
scrolls the last part of the data into focus.

How do I either prevent this scrolling or reset the TreeView control's view?

Hi jp2msft,

By default, TreeView control doesn't focus last tree node. Perhaps, you
make something that makes this behavior.

To prevent scrolling you can insert javascript like this at the bottom
your page :
<script>
window.scroll(0 ,0);
</script>

--
Paul Musso
Sep 17 '08 #4

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

Similar topics

0
1365
by: sonali_reddy123 | last post by:
Hi, I am having a problem regarding use of a treeview. The problem is whether it is possible to set a default position to the scrollbar so that if any of the treenode contains the text bigger than the size specified for the treeview the scroll doesn't move to the treeview max size and display the end of the node's content but should stay at some specified position and user may move it later to view entire text.
10
15451
by: WJA | last post by:
I'm looking at building an application that needs to display 4 levels of hierarchical data. Initially the obvious choice for this would seem to be the treeview control. After searching this newsgroup I've found that there is a lot of opinion that says to stay away from the treeview if at all possible due to lack of documentation and distribution problems. Added to this, I've never used it before and don't need a new learning curve at the...
0
247
by: Gabriel Lozano-Morán | last post by:
Hello I am developing a multi-lingual web site where users can change the language on-the-fly. Now I have created a treeview that will be used as a navigation menu. The users can offcourse expand nodes but the problem is that when users change the languages I need to reload the treeview but the expanded nodes need to stay expanded. The items in the treeview are not fixed but are pulled from a data source. Eg:
0
1145
by: Elliot | last post by:
The following code creates 2 node objects in a treeview control. When I click on the second node, a process object corectly launches "http://www.cnn.com" but focus immediately returns to the treeview control. It shouldn't. It should stay with the Internet Page. The Page is being launched from the AfterSelect Event, could that be causing the treeview control to get focus again? Any help would be appreciated. Thanks,
5
2231
by: lanem | last post by:
I want to display some drill-down data with a datagrid look. I can get the exact functionality I want with a treeview, but I don't like the way the treeview looks and formats the data. I want a multi-column table look like a datagrid. It is not as easy as just hardcoding a datagrid within a datagrid because the data may do down pretty deep. The treeview works great for this. Is there a way to make the treeview look kind of like a...
1
6369
by: mongphong28 | last post by:
Hi, I'm using a treeview as a menu, and when the user clicks on a node I want the focus to set to a control (ie textbox) in a panel to the right. The problem I'm having is the focus will not stay on the control, but instead jumps back to the treeview. I'm setting the focus in the AfterSelect event of the treeview, and if I step through the code the desired control does have .Focused = True after I have set it, but then somewhere after...
0
1413
by: J | last post by:
Hello All! I need to be able to databind a treeview full of checkbox (selections). The many selections are subsequently used to build an SQL Query. Currently using the new VS2005 object-binding to business objects and want to stay along those same lines. I eventually need to persist these selections so another process can do other related work with the data. I am just not sure how to persist the changes in the checkbox to an object. ...
4
3008
by: Xenomorph | last post by:
I have a program where you click an item on the TreeView on the left, and then work with whatever pops up on the right. There are many entries on the TreeView, and when you click something on the right, the item on the TreeView is no longer highlighted, making it hard to keep track of which item you clicked on the TreeView. I want the item clicked on in the TreeView to turn BOLD, or get underlined, or change color or something. Just so...
5
7520
by: Max2006 | last post by:
Hi, I have a TreeView and this is my node style: <asp:TreeNodeStyle ForeColor = "#000000" Font-Size="9px" Font-Bold="false" Width="100px" NodeSpacing="3px" /> The problem is the expand button (+) resides right at the middle of multi-line text. Can I make the expand button top align instead of middle align?
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10212
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8872
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.