Hi,
Base on your description, you want to add the hoverMenu for the treenode, right?
But the treeview is some tables at runtime, you cannot get the treenode's id, but you can do like below:
1. The aspx code:
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" OnTreeNodeDataBound="TreeView1_TreeNodeDataBound"
ShowLines="True">
</asp:TreeView>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px" Style="display: none">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:Panel>
<cc1:HoverMenuExtender ID="HoverMenuExtender1" runat="server" BehaviorID="myHMEBID"
PopupControlID="Panel1" TargetControlID="Button1">
</cc1:HoverMenuExtender>
<div style="display: none">
<asp:Button ID="Button1" runat="server" Text="Button" /></div>
2. the treeview 's TreeNodeDataBound event code:
int myIndex = 0;
protected void TreeView1_TreeNodeDataBound(object sender, TreeNodeEventArgs e)
{
e.Node.Text = "<div id='myDiv" + myIndex.ToString() + "' onmouseover='showHoverMenu(\"myDiv" + (myIndex++).ToString() + "\")' onmouseout='hideHoverMenu()'>" + e.Node.Text + "</div>";
}
3. the javascript:
<script language="javascript" type="text/javascript">
var activeDivID="";
function pageLoad(){
$find("myHMEBID").add_shown(onHoverMenuShown11);
}
function onHoverMenuShown11(){
var activeDivLocation = $common.getLocation($get(activeDivID));
$common.setLocation($find("myHMEBID").get_popupElement(),new Sys.UI.Point(activeDivLocation.x + $get(activeDivID).offsetWidth,activeDivLocation.y));
$get("<%=TextBox1.ClientID %>").value = $get(activeDivID).innerText;
}
function showHoverMenu(divID){
activeDivID = divID;
$find("myHMEBID")._onUnhover();
$find("myHMEBID")._onHover();
}
function hideHoverMenu(divID){
$get("<%=Panel1.ClientID %>").style.display= "none";
}
</script>
Hope it helps.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Yours sincerely,
Amanda Wang
Microsoft Online Community Support