ASTreeView Demo:Add, Edit & Delete nodes

发布时间:2016-12-11 10:23:14 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"ASTreeView Demo:Add, Edit & Delete nodes",主要涉及到ASTreeView Demo:Add, Edit & Delete nodes方面的内容,对于ASTreeView Demo:Add, Edit & Delete nodes感兴趣的同学可以参考一下。

<script type="text/javascript"> //選擇節點 OnNodeSelectedScript="nodeSelectHandler(elem);" function nodeSelectHandler(elem){ var val = "selected node:" + elem.parentNode.getAttribute("treeNodeValue"); var vals=elem.parentNode.getAttribute("treeNodeValue"); var valt=elem.innerHTML;//獲取顯示的值 document.getElementById("<%=divConsole.ClientID %>").innerHTML += (">>" + val + "<br />"); document.getElementById("<%=TextBox1.ClientID %>").value = vals; document.getElementById("<%=TextBox2.ClientID %>").value = valt; } //parameter must be "elem" function addedHandler( elem ){ document.getElementById( "<%=divConsole.ClientID %>" ).innerHTML += ( ">>edit completed. [Node]" + elem.getAttribute("treeNodeValue") + "<br />" ); } //parameter must be "elem" function editedHandler( elem ){ document.getElementById( "<%=divConsole.ClientID %>" ).innerHTML += ( ">>edit completed. [Node]" + elem.getAttribute("treeNodeValue") + "<br />" ); } //parameter must be "val" function deletedHandler( val ){ document.getElementById( "<%=divConsole.ClientID %>" ).innerHTML += ( ">>delete completed. [Node]" + val + "<br />" ); } //elem is the LI element of each node var displayNodeFunc = function( elem ){ document.getElementById( "<%=divConsole.ClientID %>" ).innerHTML += ( ">>[Node]" + elem.getAttribute("treeNodeValue") + " [Parent]:" + elem.parentNode.parentNode.getAttribute("treeNodeValue") + " [CheckState]:" + elem.getAttribute("checkedState") + "<br />" ); } </script> <ct:ASTreeView ID="astvMyTree" runat="server" BasePath="~/Javascript/astreeview/" DataTableRootNodeValue="0" EnableRoot="false" EnableNodeSelection="true" EnableCheckbox="false" EnableDragDrop="true" EnableTreeLines="true" EnableNodeIcon="true" EnableCustomizedNodeIcon="false" AutoPostBack="false" EnableDebugMode="false" OnNodeSelectedScript="nodeSelectHandler(elem);" EnableContextMenu="true" EnableAjaxOnEditDelete="true" EditNodeProvider="~/ASTreeViewRenameNodeHandler.aspx" DeleteNodeProvider="~/ASTreeViewDeleteNodeProvider.aspx" AddNodeProvider="~/ASTreeViewDemo3.aspx" AdditionalAddRequestParameters="{'t':'ajaxAdd'}" AddNodePromptDefaultValue="New Node" AddNodePromptMessage="Hello, please add a new node:" AddNodeDataValueProvider="return prompt('new ndoe? under:' + elem.getAttribute('treeNodeValue'),'new node name');" OnNodeAddedScript="addedHandler(elem)" OnNodeEditedScript="editedHandler(elem)" OnNodeDeletedScript="deletedHandler(val)" OnOnSelectedNodeChanged="astvMyTree_OnSelectedNodeChanged" /> /// <summary> /// initial controls, bind you events etc. here /// </summary> private void InitializeComponent() { //獲取值 添加右鍵菜單進行編輯 //this.astvMyTree.ContextMenu.MenuItems.Add(new ASContextMenuItem("獲取 current value", "alert('current value:' + " + this.astvMyTree.ContextMenuClientID + ".getSelectedItem().parentNode.getAttribute('treeNodeValue')" + ");return false;", "otherevent")); this.astvMyTree.ContextMenu.MenuItems.Add(new ASContextMenuItem("獲取 current value", "alert('current value:' + " + this.astvMyTree.ContextMenuClientID + ".getSelectedItem().parentNode.getAttribute('treeNodeValue')" + ");window.location.href ='ASTreeViewEdit.aspx?EditNodeValues='+" + this.astvMyTree.ContextMenuClientID + ".getSelectedItem().parentNode.getAttribute('treeNodeValue')" + ";", "otherevent")); this.astvMyTree.ContextMenu.MenuItems.Add(new ASContextMenuItem("獲取 current text", "alert('current text:' + " + this.astvMyTree.ContextMenuClientID + ".getSelectedItem().innerHTML" + ");return false;", "otherevent")); } http://www.jinweijie.com/ http://www.astreeview.com/astreeviewdemo/astreeviewdemo1.aspx

上一篇:html5中页面拨打电话的方式
下一篇:【C++进阶】__stdcall 详解

相关文章

相关评论