Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > how to set focus to a treeview on form load

Reply
Thread Tools

how to set focus to a treeview on form load

 
 
adiel
Guest
Posts: n/a
 
      09-09-2003
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
 
Reply With Quote
 
 
 
 
Eidolon
Guest
Posts: n/a
 
      09-09-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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



 
Reply With Quote
 
 
 
 
adiel
Guest
Posts: n/a
 
      09-10-2003
Thanks Eidolon, after much research, I was able to fix the problem and
I also decided to create an article for this in case someone else runs
into this problem. Here is the link to the article:

http://www.codeproject.com/useritems...o_treeview.asp
 
Reply With Quote
 
adiel
Guest
Posts: n/a
 
      09-12-2003
They updated the link. The new link is:

http://www.codeproject.com/aspnet/se...o_treeview.asp

Thanks,
Adiel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Set focus to a textbox on page load Water Cooler v2 ASP .Net 4 01-13-2011 07:34 PM
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM
Why does putting focus on textbox also set focus to submit jw56578@gmail.com Javascript 2 06-06-2005 08:20 PM
set the focus to a control in an ASP.NET during the page load Kanna ASP .Net 0 12-10-2003 09:18 AM



Advertisments