예제 #1
0
        public static void LoadZonesOrderByName(ListItemCollection lstZones)
        {
            lstZones.Clear();
            DataTable dtItems = ZoneDB.GetByParentIDOrderByName(0);

            foreach (DataRow row in dtItems.Rows)
            {
                ListItem item = new ListItem();
                item.Value = row["Zone_ID"].ToString();
                item.Text  = row["Zone_Name"].ToString();
                item.Attributes.Add("Level", "0");
                lstZones.Add(item);
                LoadZoneItemsOrderByName(lstZones, item);
            }
        }
예제 #2
0
        private static void LoadZoneItemsOrderByName(ListItemCollection lstZones, ListItem curItem)
        {
            int level = Convert.ToInt32(curItem.Attributes["Level"]);

            level += 1;
            int       curZoneID    = ConvertUtility.ToInt32(curItem.Value);
            DataTable dtChildItems = ZoneDB.GetByParentIDOrderByName(curZoneID);

            foreach (DataRow row in dtChildItems.Rows)
            {
                ListItem childItem = new ListItem();
                childItem.Text  = MiscUtility.StringIndent(level) + row["Zone_Name"];
                childItem.Value = row["Zone_ID"].ToString();
                childItem.Attributes.Add("Level", level.ToString());
                lstZones.Add(childItem);
                LoadZoneItems(lstZones, childItem);
            }
        }