惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
Simon Willison's Weblog
Simon Willison's Weblog
B
Blog
V
Visual Studio Blog
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
S
SegmentFault 最新的问题
博客园 - 司徒正美
博客园 - 【当耐特】
T
Tenable Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium
S
Secure Thoughts
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
IT之家
IT之家
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
大猫的无限游戏
大猫的无限游戏
PCI Perspectives
PCI Perspectives
H
Hackread – Cybersecurity News, Data Breaches, AI and More
阮一峰的网络日志
阮一峰的网络日志
P
Privacy International News Feed
N
News and Events Feed by Topic
H
Hacker News: Front Page
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure
Google Online Security Blog
Google Online Security Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
H
Heimdal Security Blog
Project Zero
Project Zero
C
CERT Recently Published Vulnerability Notes
MyScale Blog
MyScale Blog
AI
AI
月光博客
月光博客
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
WordPress大学
WordPress大学
L
Lohrmann on Cybersecurity
TaoSecurity Blog
TaoSecurity Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
CXSECURITY Database RSS Feed - CXSecurity.com
Spread Privacy
Spread Privacy
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
SecWiki News
SecWiki News
C
Cisco Blogs
The Last Watchdog
The Last Watchdog

博客园 - Kenny田

iOS 下 Podfile 使用方法 使用 NVM 管理不同的 Node.js 版本 将React Native集成至Android原生应用 Gradle在Windows环境与Linux上配置有哪些不同? 学习Android Studio里的Gradle 解决 Android Studio 乱码问题 不知道如何处理的Windows Phone异常 用命令行安装并启动Windows Phone 8 App 在Windows Phone项目中调用C语言DLL 演示Microsoft Advertising SDK for Windows Phone 8.1 PLSQL Developer 初始化错误 [原]初次运用数据缓存机制 [原]执行存储过程后返回影响的行数 [原]可定义的英文小日历 可逆加密解密程序(ASP版) 全文服务(Microsoft 搜索)不可用。系统管理员必须启动此服务 [转]解决sql2000挂起无法安装的问题 [转]安装SQL Server 2000 时出现 command line option syntax error [原]如何将一个表中的某一列的数据全部复制到另一个表中
[原]有TreeNode”并不包含“Nodes”的定义困扰的朋友看过来
Kenny田 · 2008-06-08 · via 博客园 - Kenny田

  在用TreeView的时候可能会出现ystem.Web.UI.WebControls.TreeNode”并不包含“Nodes”的定义
  那是我们都用了类似下面的代码(我已经修正了错误)

  DataSet ds = null;
  
protected void Page_Load(object sender, EventArgs e)
  
{
    
if (!IsPostBack)
    
{
      
string sql = "select class_id,class_name,class_parentid from proclass";
      ds 
= KennyDataOp.GetDataSet(sql);
      AddTree(
0, (TreeNode)null"Product.aspx?cid=");
    }

  }

  
public void AddTree(int ParentID, TreeNode pNode,string urls)
  
{
    DataView dvTree 
= new DataView(ds.Tables[0]);
    
//过滤ParentID,得到当前的所有子节点
    dvTree.RowFilter = "[class_parentid] = " + ParentID;
    
foreach (DataRowView Row in dvTree)
    
{
      TreeNode Node 
= new TreeNode();
      
if (pNode == null)
      
{    //添加根节点
        Node.Text = Row["class_name"].ToString();
        Node.NavigateUrl 
= urls + Row["class_id"].ToString();
        
this.TreeView1.Nodes.Add(Node);
        Node.Expanded 
= true;
        AddTree(Int32.Parse(Row[
"class_id"].ToString()), Node, urls); //再次递归
      }

      
else
      
{  //添加当前节点的子节点
        Node.Text = Row["class_name"].ToString();
        Node.NavigateUrl 
= urls + Row["class_id"].ToString();
        pNode.ChildNodes.Add(Node);
        Node.Expanded 
= true;
        AddTree(Int32.Parse(Row[
"class_id"].ToString()), Node, urls); //再次递归
      }

    }

  }

倒数第三行代码是pNode.ChildNodes.Add(Node),Not pNode.Notes.Add(Node)

VS 2005 的TreeView控件有些更改, 只有TreeView下有Nodes集合, 而TreeNode下有ChildNodes集合