/// <summary> /// 绑定线路 /// </summary> private void BindLine() { ddlline.Items.Clear(); IList <Tb_line> linelist = Tb_lineManager.getTb_lineAll(); ddlline.Items.Add(new ListItem("选择线路", "-1")); //添加第一行默认 foreach (Tb_line line in linelist) { ListItem adItem = new ListItem(); adItem.Text = line.Line; adItem.Value = line.Line; ddlline.Items.Add(adItem); } }
/// <summary> /// 绑定线路 /// </summary> public void BindLine() { ddlLine.Items.Clear(); IList <Tb_line> typelist = Tb_lineManager.getTb_lineAll(); for (int i = 0; i < typelist.Count; i++) { ListItem list = new ListItem(typelist[i].Line.ToString(), typelist[i].Id.ToString()); ddlLine.Items.Add(list); } ListItem ltem = new ListItem("选择线路", "-1"); //添加第一行默认值 ddlLine.Items.Insert(0, ltem); //添加第一行默认值 }