Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / May 2006

Tip: Looking for answers? Try searching our database.

Scroll nodes into view Treeview asp.net 2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry C - 26 May 2006 19:09 GMT
I am using VS 2005 treeview control.

How can I set focus to and scroll into view the node clicked when the page
posts back.

My treeview has many nodes and continues way beyond the bottom of the page
when expanded (scroll bar shows). When I scroll to a node and click on it the
postback occurs. When the page shows again the tree view has scrolled back so
the first node is at the top of the page and the clicked node is now out of
view.

I solve this problem in the HTML table by using the scrollIntoView of a
element in javascript. Is there a method in the treeview to do this.

Signature

Jerry

Steven Cheng[MSFT] - 29 May 2006 04:21 GMT
Hi Jerry,

Welcome to the MSDN newsgroup.

From your description, I understand you have an ASP.NET 2.0 web page which
contains a TreeView with large number of TreeNodes. And since the large
TreeView will make the page display scrollbar, you're wondering how to
gracefully keep the page scrolling to the current selected TreeNode across
multiple postbacks, correct?

Based on my research, as for the scroll position, ASP.NET 2.0 TreeView
control doesn't provide any built-in methods or setting to help maintain
the scroll postion of the current selected TreeNode. However, the ASP.NET
2.0 page does provide a setting for keeping the page's current scroll
position across multiple postbacks and this is a page wide setting rather
than specific to TreeView.

#Page.MaintainScrollPositionOnPostBack Property
http://msdn2.microsoft.com/en-us/library/system.web.ui.page.maintainscrollpo
sitiononpostback.aspx

Generally, we configure this setting through the @Page directive, e.g.

<%@ Page Language="C#" ......................
  MaintainScrollPositionOnPostback="true"%>

BTW, as for the original html/script approach you mentioned:

=================
I solve this problem in the HTML table by using the scrollIntoView of a
element in javascript. Is there a method in the treeview to do this.
=================

This is a good solution for general scenario when we can get the certain
control's client-side html element(through ID..). However, for TreeView,
its TreeNodes are not simply a certain html element(is composited by many
html elements) and there is no direct association between its Node name and
client-side html element, it's hard to utilize the "ScrollIntoview"
approach.

Just some of my understanding and suggestion, hope this helps. If you have
any other idea or consideration, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Steven Cheng[MSFT] - 31 May 2006 13:13 GMT
Hello Jerry,

How are you doing on this issue, have you got any further process or does
the suggestion in my last reply helps you a little? If there is anything
else we can help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.