protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string idString = Request.QueryString["id"]; int idInt = Convert.ToInt32(idString); if (null == idString || idString.Equals(string.Empty) || 1 > idInt) { this.showFalseMessage("请输入正确的请求代号!"); return; } NewsDAO newsDao = new NewsDAO(); DataSet infoDataset = newsDao.GetNewsInfo(idInt); if (null == infoDataset || 0 == infoDataset.Tables.Count || 0 == infoDataset.Tables[0].Rows.Count) { this.showFalseMessage("未找到所请求的新闻!"); return; } DataRow infoDatarow = infoDataset.Tables[0].Rows[0]; int outline_id = Convert.ToInt32(infoDatarow["outline_id"].ToString()); this.OutlineRadioButtonList.Items.FindByValue(outline_id.ToString()).Selected = true; DataSet categoryDataset = newsDao.GetCategory(outline_id, "category"); this.CategoryDropDownList.DataSource = categoryDataset; this.CategoryDropDownList.DataTextField = "name"; this.CategoryDropDownList.DataValueField = "id"; this.CategoryDropDownList.DataBind(); this.CategoryDropDownList.Items.FindByValue(infoDatarow["category_id"].ToString()).Selected = true; this.TitleTextBox.Text = infoDatarow["title"].ToString(); this.ArticleTextBox.Text = infoDatarow["article"].ToString(); } }