Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            StringBuilder strBuilder = new StringBuilder();

            EyouSoft.BLL.CompanyStructure.Province           pBll = new EyouSoft.BLL.CompanyStructure.Province();
            IList <EyouSoft.Model.CompanyStructure.Province> list = pBll.GetList(CompanyId);

            strBuilder.AppendFormat("<option value=\"0\">请选择</option>");
            if (list != null && list.Count > 0)
            {
                foreach (EyouSoft.Model.CompanyStructure.Province p in list)
                {
                    if (p.Id == ProvinceId)
                    {
                        strBuilder.AppendFormat("<option value=\"{0}\" selected=\"selected\">{1}</option>", p.Id, p.ProvinceName);
                        continue;
                    }
                    strBuilder.AppendFormat("<option value=\"{0}\">{1}</option>", p.Id, p.ProvinceName);
                }
            }
            provinceHtml = strBuilder.ToString();
        }
Beispiel #2
0
        //绑定省
        protected void BindPro()
        {
            //清空省份的下拉框
            this.ddlPro.Items.Clear();
            //添加默认选择项"-请选择-"
            this.ddlPro.Items.Add(new ListItem("-请选择-", "0"));
            //省份BLL
            EyouSoft.BLL.CompanyStructure.Province proBll = new EyouSoft.BLL.CompanyStructure.Province();
            //根据公司ID取得相应结果集list
            IList <EyouSoft.Model.CompanyStructure.Province> list = proBll.GetList(companyId);

            //循环将值添加到下拉框
            if (list != null && list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    ListItem item = new ListItem();
                    item.Text  = list[i].ProvinceName;
                    item.Value = Convert.ToString(list[i].Id);
                    this.ddlPro.Items.Add(item);
                }
            }
        }