We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Scroll a treeview so the selected node is shown

I am setting the selected node of a large tree view programmatically in a partial postback. I'm also making sure the node is expanded so it's visible. Now I want to have the tree scroll so the node is in view. How can I accomplish this? 

Thanks, Adam

5 Replies

VR Varalakshmi R.S Syncfusion Team August 29, 2012 11:38 AM UTC

Hi Adam,

 Thanks for contacting Syncfusion forums.

 We suggest you to use “(element).scrollIntoView(false)” in script to resolve this issue. please refer the below code snippet to achieve this,

<code>

[Script]

(Selected_element).scrollIntoView(false);

</code>

Regards,

Varalakshmi



AB Adam Bruss August 31, 2012 04:23 PM UTC

Varalakshmi R.S,

Could you please provide asp.net and/or C# code for a working example of this? I think it's a fairly common need.

Thanks,
Adam


VR Varalakshmi R.S Syncfusion Team September 5, 2012 11:58 AM UTC

Hi Adam,

 

Thanks for the update.

 

We have prepared simple sample in which last node of the “Inbox” item will be shown when the TreeView is expanded. Please download the sample from the link given below,

<a rel='nofollow' href='http://www.syncfusion.com/downloads/Support/DirectTrac/98119/scrollintoview258958628.zip'>scrollintoview220096624.zip</a>

Kindly try the sample and let me know if it helps.

 

Regards,

Varalakshmi



AB Adam Bruss September 25, 2012 04:46 PM UTC

We use VS 2008 so I can't open the solution. There are no .aspx files in there either. Could you provide a 2008 asp.net web application solution that implements the scroll into view feature?


VR Varalakshmi R.S Syncfusion Team September 26, 2012 11:08 AM UTC

Hi Adam,

 

We regret for the inconvenience caused.

 

We have prepared a simple web application in vs2008 to showcase this behavior and the same can be downloaded from the following link,

<a rel='nofollow' href='http://www.syncfusion.com/downloads/Support/DirectTrac/99241/F104886107619190.zip'>F104886100432492.zip</a>

 

Kindly try the sample and let us know if it works.

 

Regards,

Varalakshmi


Loader.
Live Chat Icon For mobile
Up arrow icon