客户端代码实现无刷新TreeView的复选框多选
2008-09-20 17:13
281 查看
1. 服务端加载数据.
2.设置每个节点 . NavigateUrl = "javascript:void(0)"或者设置 . NavigateUrl = "#", 但是后者在刷新页面后可能导致TreeView所在页面位置上靠; 目的是防止默认情况下点击节点导致刷新整个页面的麻烦.
3.注册节点的点击事件chkTreeView.Attributes.Add("onclick", "javascript:return CheckNode();");
4.客户端编写点击复选框的操作代码
function CheckNode()
//查找CheckBox
function FindCheckBox(rowList)
//如果没有CheckBox则查找其他节点
function FindNode(rowList)
//所有子 节点是否都是选中状态
function IsFullChildrenChecked(parentNodeTable)
//把子节点都为选中状态的父节点也设置为选中状态
function SelFullChildrenChecked(parentNodeTable)
//设置所有子节点
function SelAllChildren(currNodeTable, flagChecked)
//设置所有父节点
function SelAllParent(parentNodeTable, flagChecked)
//在XML文档中查找节点
function FindXMLNode(parentNode, nodeID)
function SetXMLNodeChecked(nodeID, checkedFlag)
function CreateXMLDoc()
function createXMLHttp()
function GetAllCheckedNodes(currNodeTable)
//获取最上一级的指标节点ID, 如果有父节点, 则只记录父节点的ID
function GetHighChildCheckedNode(currNodeTable)
//获取最上一级的指标节点ID, 如果有父节点, 则只记录父节点的ID
function GetAllChildCheckedNodes(currNodeTable)
function GetRootNode(currNodeTable, preNodeTable)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(RootNode != null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return RootNode;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(currNodeTable == null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var lastNode = FindCheckBox(currNodeTable);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(lastNode == null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
lastNode = FindNode(currNodeTable);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(lastNode == null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
RootNode = preNodeTable;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return RootNode;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
parentNodeTable = lastNode.parentElement.parentElement.parentElement.parentElement;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
parentNodeTable = parentNodeTable.parentElement.previousSibling;//父节点
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
RootNode = GetRootNode(parentNodeTable, currNodeTable);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(RootNode != null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return RootNode;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
2.设置每个节点 . NavigateUrl = "javascript:void(0)"或者设置 . NavigateUrl = "#", 但是后者在刷新页面后可能导致TreeView所在页面位置上靠; 目的是防止默认情况下点击节点导致刷新整个页面的麻烦.
3.注册节点的点击事件chkTreeView.Attributes.Add("onclick", "javascript:return CheckNode();");
4.客户端编写点击复选框的操作代码
function CheckNode()
//查找CheckBox
function FindCheckBox(rowList)
//如果没有CheckBox则查找其他节点
function FindNode(rowList)
//所有子 节点是否都是选中状态
function IsFullChildrenChecked(parentNodeTable)
//把子节点都为选中状态的父节点也设置为选中状态
function SelFullChildrenChecked(parentNodeTable)
//设置所有子节点
function SelAllChildren(currNodeTable, flagChecked)
//设置所有父节点
function SelAllParent(parentNodeTable, flagChecked)
//在XML文档中查找节点
function FindXMLNode(parentNode, nodeID)
function SetXMLNodeChecked(nodeID, checkedFlag)
function CreateXMLDoc()
function createXMLHttp()
function GetAllCheckedNodes(currNodeTable)
//获取最上一级的指标节点ID, 如果有父节点, 则只记录父节点的ID
function GetHighChildCheckedNode(currNodeTable)
//获取最上一级的指标节点ID, 如果有父节点, 则只记录父节点的ID
function GetAllChildCheckedNodes(currNodeTable)
function GetRootNode(currNodeTable, preNodeTable)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(RootNode != null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return RootNode;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(currNodeTable == null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var lastNode = FindCheckBox(currNodeTable);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(lastNode == null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
lastNode = FindNode(currNodeTable);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(lastNode == null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
RootNode = preNodeTable;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return RootNode;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
parentNodeTable = lastNode.parentElement.parentElement.parentElement.parentElement;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
parentNodeTable = parentNodeTable.parentElement.previousSibling;//父节点
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
RootNode = GetRootNode(parentNodeTable, currNodeTable);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(RootNode != null)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return RootNode;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
相关文章推荐
- 用jQuery实现.net 2.0 treeview客户端无刷新操作的实例
- TreeView无刷新获取text及value实现代码
- 在 ASP.NET 网页中不经过回发而实现客户端回调(附Gridview无刷新代码)
- 基于.NET 2.0的GIS开源项目SharpMap分析手记(十四):ASP.NET2.0实现无刷新客户端回调的Callback机制及例子代码下载
- 在 ASP.NET 网页中不经过回发而实现客户端回调(附Gridview无刷新代码)
- TreeView无刷新获取text及value实现代码
- ASP.NET2.0实现无刷新客户端回调
- java wsdl反向生成源码,并使用CXF实现客户端调用代码
- asp.net中利用Jquery+Ajax+Json实现无刷新分页的实例代码
- ASP.NET2.0实现无刷新客户端回调
- 基于Qt的SocketIO客户端实现 【一】开源代码的选择
- asp.net点击 查看更多 实现无刷新加载的实现代码
- ThinkPHP结合ajax、Mysql实现的客户端通信功能代码示例
- ASP.NET2.0实现无刷新客户端回调
- 用客户端JS实现微软TreeView控件父子节点联选!
- vue使用mint-ui实现下拉刷新和无限滚动的示例代码
- 客户端回调实现gridView无刷新分页第十一页
- 客户端回调实现gridView无刷新分页第十九页
- 代码分析-DataGrid实现自增列、单选、多选 选择自 yangyifan0 的 Blog
- [转] Socket心跳包异常检测的C语言实现,服务器与客户端代码案例