private void Bind() { ColumnDal dblm = new ColumnDal(); var list = dblm.FindAll(); ddllm.DataSource = list; ddllm.DataValueField = "ID"; ddllm.DataTextField = "Title"; ddllm.DataBind(); ListItem item1 = new ListItem(); item1.Text = "请选择"; item1.Value = ""; ddllm.Items.Insert(0, item1); if (Request["type"] == "Edit") { long Id = Convert.ToInt64(Request["ID"]); var item = db.Find(Id); if (item != null) { txtbt.Text = item.Title; img1.ImageUrl = item.ImgStr; txtbz.Text = item.ShortTxt; txtnr.Text = item.Content; ddllm.SelectedValue = item.CID.ToString(); } else { //找不到数据就返回列表 Response.Redirect("ColumnListPG.aspx"); } } }