Mouse click in Treeview control(ASP.net server control)
ASP.NET
2
Posts
2
Posters
0
Views
1
Watching
-
I would like to perform mouse click(right / single / double ) in a every node of an treeview control. But no such event is avail for this control. How can i perform this operation ?.
Jey
Hi there, In this case, you can customise the TreeView control to do what you want. You can create a custom TreeNode as below and override the
RenderPreText/RenderPostText
method:public class ExTreeNode : TreeNode
{
protected override void RenderPreText(HtmlTextWriter writer)
{
base.RenderPreText(writer);
writer.AddAttribute("onmouseover", "alert('hover me')");
}
}Also, to make the TreeView control work properly on postback, you may need to create a custom TreeView control by inheriting the built-in control and override the protected
CreateNode
method.