Hi,
I want to display the Add, View buttons when hovered on the tree node. I tried to put the AJAX HoverMenuExtender control in ItemTemplate of WebDataTree. On Node_DataBound event, I am not able find the HoverMenuExtender control which is in WebDataTree's ItemTemplate. If I am able to find the control, I need to set it's TargetControlId property to each node's unique id. How to find the control and how to get the tree node's unique id?
Or Is there any other way to implement hover functionality with Infragistics controls?
Thanks
Would you consider using a Div onmouseover function? The following code snippet would give you the text of the node that you hover on:
function hover_function(e) {
e.srcElement.outerText;
}
<div onmouseover = "hover_function(event)" >
< ig:WebDataTree .....
This could be an easier solution.
Magued
Thanks, That code is working fine, If I put the Template in aspx page. But I am not setting datasource to the tree view and manually creating the tree nodes like the below:
DataTreeNode
newNode = new DataTreeNode();
newNode.Text = ownerships.ElementAt(i).NameAndStake;
newNode.Value = ownerships.ElementAt(i).Id.ToString();
tree.Nodes.Add(newNode);
In the above case how can we create the template on server side and where to set the node.Template = "Template1" and node.EnsureTemplates()?
You can manipulate the controls inside the template for example, using FindControl:
protected void WebDataTree1_NodeBound(object sender, Infragistics.Web.UI.NavigationControls.DataTreeNodeEventArgs e)
{
if (e.Node.Level == 1)
e.Node.TemplateId = "Template1";
e.Node.EnsureTemplate();
Control c = e.Node.FindControl("Label1");
The enclosed sample does the same functionality.
I came across that sample, that was done using client side code on Node Clicked client event like the below:
//Gets reference to the WebDataMenu
menu.showAt(
null, null, e.get_browserEvent());
But I don't want to do in client side because based on some business requirements, I have to hide the menu for some nodes. So need to handle this in serverside. How to do the same in server side? My original requirement is to display buttons on hover on treeview and not for all nodes only to some nodes. If this is not possible with Infragistics WebDataTree, I'll consider context menu as second option. While trying to implement hover, the only problem for me is not able to find the control in the template on server side.
Please review the sample at:
http://samples.infragistics.com/2010.3/WebFeatureBrowser/WebDataMenu/WebMenuContext.aspx
The sample demonstrates how to use the WebDataMenu as a context menu for tree nodes. To display the context menu click on one of the tree nodes.
Please send me if this would meet your functional requirements.