make TreeView stay at top

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?anAybXNmdA==?=

    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?
  • =?Utf-8?B?anAybXNmdA==?=

    #2
    RE: make TreeView stay at top

    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?

    Comment

    • Paul Musso

      #3
      Re: make TreeView stay at top

      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


      Comment

      • =?Utf-8?B?anAybXNmdA==?=

        #4
        Re: make TreeView stay at top

        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
        >
        >
        >

        Comment

        Working...