zoukankan      html  css  js  c++  java
  • TreeView

            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    BindTreeViewList();
                }
            }
            private void BindTreeViewList()
            {
                Provinces m_provinces = new Provinces();
                IList<Provinces> il_provinces= ProvincesByManager.SelectCollection("1=1",false,false);
                TreeNode node;
                for (int i = 0; i<il_provinces.Count; i++)
                {
                    node = new TreeNode();
                    node.Text = il_provinces[i].Province;
                    node.Value = il_provinces[i].Provinceid;
                    this.TreeView_areaList.Nodes.Add(node);
                }
            }
            protected void TreeView_areaList_SelectedNodeChanged(object sender, EventArgs e)
            {
                TreeView_areaList.SelectedNode.ChildNodes.Clear();
                IList<Cities> il_cities = CitiesByManager.SelectCollection("1=1 and provinceid=" + TreeView_areaList.SelectedValue + "", false, false);
                TreeNode node;
                if (il_cities.Count > 0)
                {
                    for (int i = 0; i < il_cities.Count; i++)
                    {
                        node = new TreeNode();
                        node.Text = il_cities[i].City;
                        node.Value = il_cities[i].Cityid;
                        TreeView_areaList.SelectedNode.ChildNodes.Add(node);
                        TreeView_areaList.SelectedNode.Expand();
                    }
                }
                else {
                    IList<Areas> il_areas = AreasByManager.SelectCollection("1=1 and cityid=" + TreeView_areaList.SelectedValue + "", false, false);
                    if (il_areas.Count > 0)
                    {
                        for (int i = 0; i < il_areas.Count; i++)
                        {
                            node = new TreeNode();
                            node.Text = il_areas[i].Area + "<input id=\"txt_area" + i + "\" type=\"text\" runat=\"server\" value=\"" + il_areas[i].Area + "\" /><input id=\"btn_\" type=\"button\" runat=\"server\" value=\"修改\" />";
                            node.Value = il_areas[i].Areaid;
                            TreeView_areaList.SelectedNode.ChildNodes.Add(node);
                            TreeView_areaList.SelectedNode.Expand();
                        }
                    }
                }
            }

  • 相关阅读:
    BZOJ 1391: [Ceoi2008]order
    BZOJ 4504: K个串
    2019 年百度之星·程序设计大赛
    POJ 2398 Toy Storage (二分 叉积)
    POJ 2318 TOYS (二分 叉积)
    HDU 6697 Closest Pair of Segments (计算几何 暴力)
    HDU 6695 Welcome Party (贪心)
    HDU 6693 Valentine's Day (概率)
    HDU 6590 Code (判断凸包相交)
    POJ 3805 Separate Points (判断凸包相交)
  • 原文地址:https://www.cnblogs.com/fingal/p/5586860.html
Copyright © 2011-2022 走看看