how to set focus to a treeview on form load

Discussion in 'ASP .Net Web Controls' started by adiel, Sep 9, 2003.

  1. adiel

    adiel Guest

    Hello, I noticed when my page loads that when I pass the mouse over an
    element in the treeview, the colors are lighter. Then I realized if I
    click in an empty area inside the treeview, the colors are now darker
    when I mouse over an element. The problem is of course that the
    treeview does not have focus when the form loads. My question is, how
    do I set focus to the treeview when the form loads?

    I guess I am looking for something like:

    TreeView1.Focus

    But such property does not exist. Has anyone been able to set focus
    to the microsoft treeview when the form is first loaded?

    Thanks before hand,
    Adiel
    adiel, Sep 9, 2003
    #1
    1. Advertising

  2. adiel

    Eidolon Guest

    Well, this is not the exACT code youd be looking for, but it may help... i
    would *guess* you would simply need to replace "txtID" with the ID of your
    treeview.

    'Set the script to focus and select the TextBox
    RegisterStartupScript("focus", "<script language=""JavaScript"">" & vbCrLf
    & _
    vbTab & "Form1." & txtID.ClientID & ".focus();" & _
    vbCrLf & vbTab & "Form1." & txtID.ClientID & ".select();" & _
    vbCrLf & "<" & "/script>")


    "adiel" <> wrote in message
    news:...
    > Hello, I noticed when my page loads that when I pass the mouse over an
    > element in the treeview, the colors are lighter. Then I realized if I
    > click in an empty area inside the treeview, the colors are now darker
    > when I mouse over an element. The problem is of course that the
    > treeview does not have focus when the form loads. My question is, how
    > do I set focus to the treeview when the form loads?
    >
    > I guess I am looking for something like:
    >
    > TreeView1.Focus
    >
    > But such property does not exist. Has anyone been able to set focus
    > to the microsoft treeview when the form is first loaded?
    >
    > Thanks before hand,
    > Adiel
    Eidolon, Sep 9, 2003
    #2
    1. Advertising

  3. adiel

    adiel Guest

    adiel, Sep 10, 2003
    #3
  4. adiel

    adiel Guest

    adiel, Sep 12, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kanna
    Replies:
    0
    Views:
    407
    Kanna
    Dec 10, 2003
  2. Water Cooler v2

    Set focus to a textbox on page load

    Water Cooler v2, Aug 17, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    20,178
    drujba
    Jan 13, 2011
  3. Justin Dutoit
    Replies:
    0
    Views:
    1,123
    Justin Dutoit
    Feb 27, 2009
  4. Replies:
    2
    Views:
    328
    Thomas 'PointedEars' Lahn
    Jun 6, 2005
  5. Roger
    Replies:
    3
    Views:
    309
Loading...

Share This Page