コード例 #1
0
        void BindDataToDropDpownList()
        {
            List <User> cities = bll.GetDropDownCities();

            foreach (User c in cities)
            {
                ListItem li = new ListItem(c.CityName, c.CityID.ToString());
                DropDownList1.Items.Add(li);
            }
            ListItem li2 = new ListItem("--Select City--", "-1");

            DropDownList1.Items.Insert(0, li2);


            List <Admin> status = bll.GetDropDownListStatus();

            foreach (Admin a in status)
            {
                ListItem li3 = new ListItem(a.SelectStatusName, a.SelecteStatusID.ToString());
                DropDownList2.Items.Add(li3);
            }
            ListItem li4 = new ListItem("--Select Status--", "-1");

            DropDownList2.Items.Insert(0, li4);
        }