/// <summary> /// 初始加载 /// </summary> private void OnStart(object sender, EventArgs e) { IList<Owen.Model.Model_MedicalRelation> lists = new Owen.BLL.BLL_MedicalRelation().GetEntities(string.Format(" MedicalID = {0} and RelationType = {1} ", medicalId, (int)Owen.Common.InfiniteType.Surgery)); if (lists.Count == 0) return; int r = lists[0].RelationID; Owen.BLL.BLL_Infinite bllInfinite = new Owen.BLL.BLL_Infinite(); Owen.Model.Model_Infinite mInfinite = bllInfinite.GetEntity(r); if (mInfinite == null) return; int level = mInfinite.LevelNum; if (level == 2) { ddlFirst.SelectedValue = mInfinite.ParentID.ToString(); ddlFirst_SelectedIndexChanged(sender, e); foreach (var v in lists) { //选择 foreach (ListItem li in this.cblSur.Items) { if (v.RelationID.ToString().Equals(li.Value)) { li.Selected = true; } } } } }
/// <summary> /// 绑定城市 /// <param name="id">上级节点Id</param> /// <param name="ddl">绑定的控件</param> /// </summary> private void Bind(int id, ListControl ddl) { IList<Owen.Model.Model_Infinite> list = new Owen.BLL.BLL_Infinite().GetEntities((int)Owen.Common.InfiniteType.Surgery, id); ddl.DataTextField = "InfiniteName"; ddl.DataValueField = "InfiniteID"; ddl.DataSource = list; ddl.DataBind(); ddl.Items.Insert(0, new ListItem("--请选择--", "")); }