472,977 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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.ExpandAll(); 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 5930
Found a quick fix already:

After TreeView1.ExpandAll(),
set TreeView1.TopNode = 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.ExpandAll(); 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.ExpandAll(); 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.TopNode = 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.ExpandAll(); 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
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...
10
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...
0
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...
0
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...
5
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...
1
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...
0
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...
4
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...
5
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...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

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.