如何获取树视图的根和父文本? [英] How to get the root and parent Text of the Tree View ?
问题描述
大家好,当用户在特定"节点上进行选择时,请帮助我查找此节点的层次结构.请检查我的代码
Hi all please help me in finding the hierarchy of this node when user select on the Particular node.Please check my code
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.contextMenu.js" type="text/javascript"></script>
<link href="jquery.contextMenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function () {
$("#MyTreeDiv A").contextMenu({
menu: 'myMenu'
}, function (action, el, pos) {
alert('Element text: ' + $(el).parent().text());
});
});
//end document Ready
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="MyTreeDiv">
<asp:TreeView ID="MyTreeView" runat="server">
</asp:TreeView>
</div>
<input type="button" id="tb" value="CLICK" class="customerRow" />
<div>
<!-- Right Click Menu -->
<ul id="myMenu" class="contextMenu">
<li class="copy"><a href="#add">Add</a></li>
<li class="edit"><a href="#edit">Edit</a></li>
<li class="delete"><a href="#delete">Delete</a></li>
<li class="quit separator"><a href="#cancel">Cancel</a></li>
</ul>
</div>
</form>
</body>
在这里,我枚举了D驱动器中的目录,并将数据绑定到树形视图.假设如果有这样的视图,我想找到Hirerachy
Parent_Folder
Child_Folder_1
Child_Folder_1_1
每当用户右键单击Child_Folder_1_1时,我需要找到Hirerachy级别并将其存储在数据库中.请告诉我如何使用jquery进行查找.
Here i have Enumerated the Directories from the D Drive and Bound the data to the treeview.Suppose if have a view like this i want to find the Hirerachy
Parent_Folder
Child_Folder_1
Child_Folder_1_1
When ever user right click the Child_Folder_1_1 i need to find the Hirerachy level and store this in a DB.Please tell me how to find using jquery.
推荐答案
(文档) .ready(function(){
(document).ready(function () {
(#MyTreeDiv A").contextMenu({ 菜单:"myMenu" },函数(action,el,pos){ alert('Element text:'+
("#MyTreeDiv A").contextMenu({ menu: 'myMenu' }, function (action, el, pos) { alert('Element text: ' +
(el).parent().text()); }); }); //结束文档准备就绪 < /script > < /head >
(el).parent().text()); }); }); //end document Ready </script> </head>
<body>
<form id="form1" runat="server">
<div id="MyTreeDiv">
<asp:TreeView ID="MyTreeView" runat="server">
</asp:TreeView>
</div>
<input type="button" id="tb" value="CLICK" class="customerRow" />
<div>
<!-- Right Click Menu -->
<ul id="myMenu" class="contextMenu">
<li class="copy"><a href="#add">Add</a></li>
<li class="edit"><a href="#edit">Edit</a></li>
<li class="delete"><a href="#delete">Delete</a></li>
<li class="quit separator"><a href="#cancel">Cancel</a></li>
</ul>
</div>
</form>
</body>
在这里,我枚举了D驱动器中的目录,并将数据绑定到树形视图.假设如果有这样的视图,我想找到Hirerachy
Parent_Folder
Child_Folder_1
Child_Folder_1_1
每当用户右键单击Child_Folder_1_1时,我需要找到Hirerachy级别并将其存储在数据库中.请告诉我如何使用jquery进行查找.
Here i have Enumerated the Directories from the D Drive and Bound the data to the treeview.Suppose if have a view like this i want to find the Hirerachy
Parent_Folder
Child_Folder_1
Child_Folder_1_1
When ever user right click the Child_Folder_1_1 i need to find the Hirerachy level and store this in a DB.Please tell me how to find using jquery.
这篇关于如何获取树视图的根和父文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!