Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8628799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:38:30+00:00 2026-06-12T08:38:30+00:00

I have the following problem. I have a tree view control in .NET and

  • 0

I have the following problem.

I have a tree view control in .NET and I have created a autocomplete search box to search the tree for a name – which then I can select and it highlights the item with a selected class.

The tree view is pretty long so I have given it a height and overflow scroll.

The problem is that I want view or scroll down to the selected item when I’ve searched for it.

So i have created the following script to scrollIntoView it but this doesn’t seem to work:

function search_itemSelected(sender, e) {
        var hdSearchID = $get('<%= hdSearchID.ClientID %>');
        hdSearchID.value = e.get_value();
        var selectedElement = $("div.node.cen.selected"); // This works
        if (selectedElement != null) {
            selectedElement[0].scrollIntoView = 10; // This keeps coming back as undefined
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:38:31+00:00Added an answer on June 12, 2026 at 8:38 am

    First: change

    if (selectedElement != null)
    

    to

    if (selectedElement.length)
    

    because $("div.node.cen.selected"); will never return null. jQuery always returns a jQuery object (empty or not, but a jQuery object)

    So in the case where it is empty, the selectedElement[0] will return undefined and thus the scrollIntoView does not exist..

    Second: scrollIntoView is a function and so you do not assign a value to it. You need to call it with

    selectedElement[0].scrollIntoView();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem: I am given a tree with N apples, for
I have following problem: I have to make a ASP.NET Webapplication with a two-row
if have the following problem: I have a List which i am going through
Hi I have the following problem. Given a Tree I want to be able
I have another problem that I can't solve I have a following code that
Well, I have the following problem: I've painted the tree cells in different colors
I have a following problem. I have some items in my treeview which are
I have the following XAML code as part of a custom control: <telerik:RadTreeView x:Name=treeModules>
I have following problem: I have built a tabbar application with 4 tabs. I
I have following problem, Code: String a=Yeahh, I have no a idea what's happening

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.