protected void SelectBtn_Click(object sender, EventArgs e) { if (SelectDropDownList.SelectedValue == "0") { TitleSelectBox.Enabled = true; NoticeDatalistList.DataSource = info.GetAllByTime(); NoticeDatalistList.DataBind(); } else if (SelectDropDownList.SelectedValue == "1") { if (TitleSelectBox.Text.Equals("") || TitleSelectBox.Text == null) { Response.Write("<script language='javascript'>alert('请输入要查询的标题!')</script>"); Response.Write(SelectDropDownList.SelectedValue); } else { NoticeDatalistList.DataSource = info.GetTitle(TitleSelectBox.Text.ToString()); NoticeDatalistList.DataBind(); } } else { NoticeDatalistList.DataSource = new List <Model.Notice> { info.Getnewtime() }; NoticeDatalistList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { Model.Notice now_info = new Model.Notice(); if (!IsPostBack) { //content = "ada"; NoticeDatalistList.DataSource = info.GetAllByTime(); NoticeDatalistList.DataBind(); now_info = info.Getnewtime(); TitleLbl.Text = now_info.Title; TimeLbl.Text = now_info.Time.ToString(); AuthorLbl.Text = now_info.Author; infoBox.InnerHtml = now_info.Info; } }