Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi. i have inserted an Treeview on my web application. currently when i do an mouse hover on the treeview the cursor is showing as a hand. but i want to a arrow as my mouse cursor when i do a mouse hover on my treeview. after doing some surfing on the internet ifound the below code to change it to arrow.



VB
Private Sub TREEVIEW1_(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TreeView1.NodeMouseHover

        Me.TreeView1.Cursor = Cursors.arrow
 
 End Sub




But using the above code its throwing syntax error at 'Treeview1.NodeMouseHover', 'Treeview1.cursor' and 'Cursors.arrow' that this events are not part of system.web.ui.webcontrols.treeview.

when i tried tying Treeview. in the Vb code, even in the event suggestions block also there are no events related to Mouse (Like NodeMouseHover, MouseUp, Mousedown, etc.,). I even checked the properties of treeview, there are no events related to Mouse. where i'm i going wrong? do i need to add any additional packages to my class? or do i need to add any HTML style tags? Can someone please suggest me what i need to do to get mouse events for my treeview in visual studio using VB.net... Please
Posted
Updated 1-Apr-15 3:22am
v2

1 solution

That code is for a Windows Forms TreeView control. For an ASP.NET TreeView control, you need to use CSS[^] to change the cursor.

In your .aspx file:
aspx
<asp:TreeView runat="server" NodeStyle-CssClass="tree-node" ...

In your .css file:
CSS
.tree-node
{
    cursor: default;
}
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 1-Apr-15 11:51am    
5ed.

Richard,

Congratulations with the 1st of April!

I would like to use the occation to invite your to see my new 1 of April publication and have some fun:
Some Programming Approaches to "Neuro-Linguistic Programming".
Participation in this game in Comments and Discussions is especially encouraged.

This time, I put more effort in the work. The fun and mocking is supposed to be combined with quite serious hints, in a satical form, on how we can conduct our discussions, give and use advice, add references and use them, use critical thinking, learn and use our own brains.

Thank you.
—SA
Member 11572452 1-Apr-15 13:55pm    
Hi Richard, thanks for your suggestion. i'll work on that. But can't we achieve this by using VB code? i mean through .aspx.vb file

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900