Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            SelectAreas sa = new SelectAreas();
            IList<Areas> areas = sa.GetAreas(Session["userid"].ToString());

            foreach (Areas area in areas)
            {
                TreeNode tn = new TreeNode();
                tn.Text = area.Area_Name;
                tn.Value = area.ID.ToString();

                //suburb

                IList<Areas> suburbs = sa.Getsuburb(area.ID.ToString(), Session["userid"].ToString());
                foreach (Areas suburb in suburbs)
                {
                    TreeNode tv = new TreeNode();
                    tv.Text = suburb.Area_Name;
                    tv.Value = suburb.ID.ToString();
                    TreeNode node = new TreeNode();
                    node.Text = "";
                    tv.ChildNodes.Add(node);
                    tv.Expanded = false;
                    tv.CollapseAll();
                    tn.ChildNodes.Add(tv);

                }

                TreeView1.Nodes.Add(tn);
            }
        }
        //SelectAreas sa = new SelectAreas();
        //IList<Areas> areas = sa.GetAreas(Session["userid"].ToString());
        //StringBuilder sb = new StringBuilder();
        //foreach (Areas area in areas)
        //{
        //    sb.Append("<li><span>" + area.Area_Name + "</span>");
        //    sb.Append("<ul>");
        //    //suburb

        //    IList<Areas> suburbs = sa.Getsuburb(area.ID.ToString(), Session["userid"].ToString());
        //    foreach (Areas suburb in suburbs)
        //    {
        //        sb.Append("<li id=\"" + suburb.ID.ToString() + "\" class=\"hasChildren\"><span>" + suburb.Area_Name + "</span>");
        //        sb.Append("<ul>");
        //        sb.Append("<li><span class=\"placeholder\">&nbsp;</span></li>");
        //        sb.Append("</ul>");
        //        sb.Append("</li>");
        //    }

        //    sb.Append("</ul>");
        //    sb.Append("</li>");
        //}
        //ltlArea.Text = sb.ToString();
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SelectAreas   sa    = new SelectAreas();
            IList <Areas> areas = sa.GetAreas(Session["userid"].ToString());

            foreach (Areas area in areas)
            {
                TreeNode tn = new TreeNode();
                tn.Text  = area.Area_Name;
                tn.Value = area.ID.ToString();

                //suburb

                IList <Areas> suburbs = sa.Getsuburb(area.ID.ToString(), Session["userid"].ToString());
                foreach (Areas suburb in suburbs)
                {
                    TreeNode tv = new TreeNode();
                    tv.Text  = suburb.Area_Name;
                    tv.Value = suburb.ID.ToString();
                    TreeNode node = new TreeNode();
                    node.Text = "";
                    tv.ChildNodes.Add(node);
                    tv.Expanded = false;
                    tv.CollapseAll();
                    tn.ChildNodes.Add(tv);
                }

                TreeView1.Nodes.Add(tn);
            }
        }
        //SelectAreas sa = new SelectAreas();
        //IList<Areas> areas = sa.GetAreas(Session["userid"].ToString());
        //StringBuilder sb = new StringBuilder();
        //foreach (Areas area in areas)
        //{
        //    sb.Append("<li><span>" + area.Area_Name + "</span>");
        //    sb.Append("<ul>");
        //    //suburb

        //    IList<Areas> suburbs = sa.Getsuburb(area.ID.ToString(), Session["userid"].ToString());
        //    foreach (Areas suburb in suburbs)
        //    {
        //        sb.Append("<li id=\"" + suburb.ID.ToString() + "\" class=\"hasChildren\"><span>" + suburb.Area_Name + "</span>");
        //        sb.Append("<ul>");
        //        sb.Append("<li><span class=\"placeholder\">&nbsp;</span></li>");
        //        sb.Append("</ul>");
        //        sb.Append("</li>");
        //    }

        //    sb.Append("</ul>");
        //    sb.Append("</li>");
        //}
        //ltlArea.Text = sb.ToString();
    }
Exemplo n.º 3
0
 public static void LoadTown(DropDownList fddl, string userid)
 {
     SelectAreas sa = new SelectAreas();
     IList<Areas> areas = sa.GetAreas(userid);
     foreach (Areas area in areas)
     {
         ListItem ddlone = new ListItem(area.Area_Name, area.ID.ToString());
         fddl.Items.Add(ddlone);
     }
     ListItem ddltwo = new ListItem("请选择郊县", "0");
     ddltwo.Selected = true;
     fddl.Items.Add(ddltwo);
 }
Exemplo n.º 4
0
    public static void LoadTown(DropDownList fddl, string userid)
    {
        SelectAreas   sa    = new SelectAreas();
        IList <Areas> areas = sa.GetAreas(userid);

        foreach (Areas area in areas)
        {
            ListItem ddlone = new ListItem(area.Area_Name, area.ID.ToString());
            fddl.Items.Add(ddlone);
        }
        ListItem ddltwo = new ListItem("请选择郊县", "0");

        ddltwo.Selected = true;
        fddl.Items.Add(ddltwo);
    }