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

推荐订阅源

J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Jina AI
Jina AI
雷峰网
雷峰网
T
Tailwind CSS Blog
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
博客园 - 司徒正美
I
InfoQ
Engineering at Meta
Engineering at Meta
Vercel News
Vercel News
小众软件
小众软件
U
Unit 42
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net

博客园 - CODE

jquery 加载 - CODE - 博客园 jquery ajxj - CODE - 博客园 页面复合表头的做法 - CODE - 博客园 sql server 行变成列的DEMO HTML 自动产生Radio分组 - CODE - 博客园 获取Table当前单元格的值 - CODE - 博客园 (转)优化数据库的思想及sql语句优化的原则 软件孵化室自助基金成立仪式 转: 移动客户端系统升级思路 转:调用Windows Mobile自带的控制面板项 程序员的基本素质 BCP的应用 VC++ 6.0访问Sql Server 协会的篮球比赛 软件协会05级高级会员离校仪式--发言稿 软输入面板 软件孵化室为筹集“静·挚”基金倡议书 微软的Webcasts系列讲座 http://www.cnblogs.com/upto/archive/2006/04/10/CompressWebService.html(收集)
自动产生树,并建立树结构 - CODE - 博客园
CODE · 2009-09-27 · via 博客园 - CODE

    private void Database(TreeView tempTree)
    {
        sqlConn = new SqlConnection(strConn);
        sqlConn.Open();
        SqlDataAdapter adapter = new SqlDataAdapter("select * From PL_Design_Template_TaskItme", sqlConn);
        DataSet ds = new DataSet();
        adapter.Fill(ds);
      
        sqlConn.Close();
        tempTree.Nodes.Clear();
        CreateTreeView(tempTree.Nodes, ds.Tables[0], 0);
    }
    private void CreateTreeView(TreeNodeCollection nodes, DataTable dataSource, int parentId)
    {
        string fifter = String.Format("UpTaskId={0}", parentId);

        DataRow[] drr = dataSource.Select(fifter);
        TreeNode Node;
        foreach (DataRow dr in drr)
        {
            Node = new TreeNode();
            nodes.Add(Node);
            Node.Text = dr["TaskName"].ToString();
            int nodeId = (int)dr["Template_TaskItmeId"];
            Node.SelectAction = TreeNodeSelectAction.None;
            CreateTreeView(Node.ChildNodes, dataSource, nodeId);
            dataSource.Rows.Remove(dr);
        }
    }

自动产生表格,把自动产的树放到表格中


        int numrows;
        int numcells;
        int i = 0;
        int j = 0;
        int row = 0;
        TableRow r;
        TableCell c;
        //产生表格
        numrows = 2;
        numcells = 3;
        for (i = 0; i < numrows; i++)
        {
            r = new TableRow();
            for (j = 0; j < numcells; j++)
            {
                c = new TableCell();
                TreeView tree = new TreeView();
                RadioButton radioBut = new RadioButton();
                radioBut.ID = "radi";
                radioBut.Text = "afdadfasdf";


                tree.ID = "tree" + j.ToString() + i.ToString();

                c.Controls.Add(radioBut);
                c.Controls.Add(tree);

                c.Width = 800;
                Database(tree);
                //c.Controls.Add(new LiteralControl("row" + j + ",cell" + i));
                r.Cells.Add(c);
            }
            Table1.Rows.Add(r);
        }