private void DdlBind() { //绑定客户类型 BLL.T_Dictionary B_Dic = new BLL.T_Dictionary(); List <Model.T_Dictionary> L_Dic = B_Dic.GetList(" and dType='D01'"); ddlType.DataSource = L_Dic; ddlType.DataTextField = "dName"; ddlType.DataValueField = "ID"; ddlType.DataBind(); //绑定一级区域 BLL.T_Regional B_Reg = new BLL.T_Regional(); List <Model.T_Regional> L_Reg = B_Reg.GetList(" and ParentID=0 order by SortNum asc,ID asc"); Model.T_Regional M_Reg = new Model.T_Regional(); M_Reg.ID = 0; M_Reg.RName = "无"; M_Reg.SortNum = 0; L_Reg.Add(M_Reg); L_Reg = L_Reg.OrderBy(o => o.SortNum).ToList(); ddlOneArea.DataSource = L_Reg; ddlOneArea.DataTextField = "RName"; ddlOneArea.DataValueField = "ID"; ddlOneArea.DataBind(); //绑定二级区域 List <Model.T_Regional> L_RegTwo = new List <Model.T_Regional>(); L_RegTwo.Add(M_Reg); ddlTwoArea.DataSource = L_RegTwo; ddlTwoArea.DataTextField = "RName"; ddlTwoArea.DataValueField = "ID"; ddlTwoArea.DataBind(); //绑定银行 List <Model.T_Dictionary> L_DicBank = B_Dic.GetList(" and dType='D03'"); Model.T_Dictionary M_Dic = new Model.T_Dictionary(); M_Dic.ID = 0; M_Dic.dName = "无"; M_Dic.dSortNum = 0; L_DicBank.Add(M_Dic); L_DicBank = L_DicBank.OrderBy(o => o.dSortNum).ToList(); ddlBank.DataSource = L_DicBank; ddlBank.DataTextField = "dName"; ddlBank.DataValueField = "ID"; ddlBank.DataBind(); }
protected void ddlOneArea_SelectedIndexChanged(object sender, EventArgs e) { int parentId = Convert.ToInt32(ddlOneArea.SelectedValue); BLL.T_Regional bll = new BLL.T_Regional(); List <Model.T_Regional> L_Reg = bll.GetList(" and ParentID=" + parentId); Model.T_Regional M_Reg = new Model.T_Regional(); M_Reg.ID = 0; M_Reg.RName = "无"; M_Reg.SortNum = 0; L_Reg.Add(M_Reg); L_Reg = L_Reg.OrderBy(o => o.SortNum).ToList(); ddlTwoArea.DataSource = L_Reg; ddlTwoArea.DataTextField = "RName"; ddlTwoArea.DataValueField = "ID"; ddlTwoArea.DataBind(); }