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.
I have sent asking development for a resolution.
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.
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.
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()?
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.
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.
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).