ASTreeView Demo:Add, Edit & Delete nodes
http://www.astreeview.com/astreeviewdemo/astreeviewdemo1.aspx
選擇節點:
<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"));
}
ASTreeView Demo:Add, Edit & Delete nodes的更多相关文章
- JqGrid: Add,Edit,Del in asp.net
https://github.com/1rosehip/jplist https://github.com/free-jqgrid/jqGrid https://plugins.jquery.com/ ...
- SharePoint 2010中列表Add和Delete事件解析
转:http://winsystem.ctocio.com.cn/26/11400026_2.shtml [IT专家网独家撰稿]SharePoint 2010与以前的版本相比,天翻地覆的变化并不为过. ...
- C# GridView Edit & Delete, 点击Delete的时候弹出确认框
1. 使用GridView自带属性ShowEditButton和ShowDeleteButton,均设为True <Columns> ... <asp:CommandField S ...
- Ubuntu 添加删除用户 How to Add and Delete Users on Ubuntu 16.04
Introduction One of the most basic tasks that you should know how to do on a fresh Linux server is ...
- LeetCode 1110. Delete Nodes And Return Forest
原题链接在这里:https://leetcode.com/problems/delete-nodes-and-return-forest/ 题目: Given the root of a binary ...
- Edit Delete Mysql的主从复制
参考博客 https://www.cnblogs.com/zhoujie/p/mysql1.html Mysql的主从复制至少是需要两个Mysql的服务,当然Mysql的服务是可以分布在不同的服务器上 ...
- 【leetcode】1110. Delete Nodes And Return Forest
题目如下: Given the root of a binary tree, each node in the tree has a distinct value. After deleting al ...
- [刷题] 237 Delete Nodes in a Linked List
要求 给定链表中的一个节点,删除该节点 思路 通过改变节点的值实现 实现 1 struct ListNode { 2 int val; 3 ListNode *next; 4 ListNode(in ...
- 【LeetCode】1110. Delete Nodes And Return Forest 解题报告 (C++)
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 递归 日期 题目地址:https://leetcode ...
随机推荐
- Error creating bean with name 'dateSource' defined in file 错误信息
问题的原因: 在web项目中搭建SSM框架,启动Tomcat时出现错误信息 有配置文件:applicationContext-mybatis.xml (Spring配置) spring-servlet ...
- 老男孩Day10作业:主机管理程序
一.作业需求: 1, 运行程序列出主机组或者主机列表 2,选择指定主机或主机组 3,选择主机或主机组传送文件(上传/下载) 4,充分使用多线程或多进程 5,不同主机的用户名,密码,端口可以不同 6,可 ...
- C# 注册Dll文件
有时会遇到dll在系统中不存在,需要程序自己去注册所需的dll文件. 注册dll 需要用到regsvr32命令,其用法为:"regsvr32 [/s] [/n] [/u] [/i[:cmdl ...
- C# winform间窗体传值简单Demo
form1是用来接收值的 using System; using System.Collections.Generic; using System.ComponentModel; using Syst ...
- Servlet完全教程
Servlet 是一些遵从Java Servlet API的Java类,这些Java类可以响应请求.尽管Servlet可以响应任意类型的请求,但是它们使用最广泛的是响应web方面的请求. Servle ...
- js 事件的阶段
事件有三个阶段: 1.事件捕获阶段 :从外向内 2.事件目标阶段 :最开始选择的那个 3.事件冒泡阶段 : 从里向外 为元素绑定事件 addEventListener("没有on的事件类 ...
- Exadata 18.1新特性--计算节点升级增强
新的计算节点升级增强能大幅缩短升级花费的时间,最快能减少40%的时间,具体的增强主要体现在以下方面: 1.计算节点操作系统的备份工作. 以前计算节点操作系统的备份工作是在正式升级之前执行,在滚动升级过 ...
- 在 Domoticz 中添加插座开关
前言 继上一篇的折腾,将 WiFi 插座刷为 ESPEasy,这次介绍一下在 Domoticz 中启用该插座的方法 步骤 在 Domoticz 控制台,设置 → 硬件中添加 Dummy,名称为&quo ...
- LeetCode记录之14——Longest Common Prefix
本题虽然是easy难度,题目也一目了然,问题就是在这里,需要考虑的特殊情况太多,太多限制.导致我一点点排坑,浪费了较多时间. Write a function to find the longest ...
- [转] Akka实战:构建REST风格的微服务
[From] http://www.yangbajing.me/2015/11/27/akka%E5%AE%9E%E6%88%98%EF%BC%9A%E6%9E%84%E5%BB%BArest%E9% ...