People have been having problems using the
TreeView control from Microsoft, for ASP.NET:
This control can be download for free from the Microsoft website. This page contains an overview of the free web controls (not supported by MS).
We will cover the focus issues for this control in this article. The reason I chose to create this article is that there was not much information after searching multiple sites. Basically this article will explain the two main problems: trying to get a
TreeView control to have focus and setting the colors properly, for hover and selected items.
Here is a list of problems trying to set focus to the Microsoft ASP.NET
- Even though you place the
TreeView inside a form, you have to use the
document object instead of the
form object to set the focus. Here is the final code:
Private Sub focusTreeview()
Dim strBuilder As StringBuilder = New StringBuilder()
After you use the code above, the
TreeView will be selected on form load and user can properly select any item from the
- Once you use the document's focus method, the colors stay in "light" mode no matter what you do, but, the
TreeView is actually selected correctly.
- The "select" statement does not have any effect on the
TreeView. So if you un-comment the line above, it will have no effect on the
- The way to make the colors not be in "light" mode is by using the filter style attribute in the
HoverStyle as follows:
filter=none has to go before the other style keywords, if not you will just get a grey color.
- Be sure to add
Imports System.Text to the top of your code in order to use the
- The features described in this article only apply to MS Internet Explorer 6.x.