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
Can you please provide me with the markup of the WebDataTree control and more information regarding your requirement. Is it similar to the implementation at:
http://mattberseth.com/blog/2007/08/how_to_use_the_hovermenuextend.html
Magued
Can you please take a look at this thread:
http://forums.infragistics.com/forums/t/48132.aspx
The only problem I am facing is not able to find the control with in the template in node_databound event. If I am able to find then I can do what is specified in this link:
http://mattberseth.com/blog/2007/08/how_to_use_the_hovermenuextend.html.
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.
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()?
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.
I don't want to do in client side because for some nodes, I don't want to display buttons when hover on node. Since users can't do anything with those nodes that means they can't add new nodes to that particular node thatswhy want to do in server side based on business conditions. Can you please take a look at the post regarding how to add the template for the treeview which is not databound (creating nodes manually).
I am attaching a sample project. First tree is working fine, I want to display second tree, which isn ot databound. Please add AjaxControlToolkit dll because I've removed it to reduce size of attached file.
The issue was resolved.
I am following up with you and if the issue was resolved.
You can add the nodes manually to the tree if you do not want to bind it. The enclosed page builds the nodes dynamically and adds an AsyncFileUpload control.