public void PageBind() { _newsType = NewsInfoCRUD.GetNewsType(); this.DropNewsList.Items.Clear(); foreach (var item in _newsType) { this.DropNewsList.Items.Add(item.typeName); this.DropNewsList.DataValueField = item.typeId.ToString(); this.DropNewsList.DataTextField = item.typeName; this.DropNewsList.SelectedIndex = 0; this.DropNewsList.DataBind(); } if (Request["newsId"] != null) { int newsId = int.Parse(Request["newsId"]); _news = NewsInfoCRUD.GetNewsSingleInfo(newsId); TxtTitle.Text = null; TxtTime.Text = null; TxtContent.Text = null; foreach (var item in _news) { TxtTitle.Text = item.newsTitle; TxtTime.Text = item.newsTime.ToString(); TxtContent.Text = item.newsContent; } } }
public void PageBind() { _newsType = NewsInfoCRUD.GetNewsType(); this.DropNewsList.Items.Clear(); foreach (var item in _newsType) { this.DropNewsList.Items.Add(item.typeName); this.DropNewsList.DataValueField = item.typeId.ToString(); this.DropNewsList.DataTextField = item.typeName; this.DropNewsList.SelectedIndex = 0; this.DropNewsList.DataBind(); } if (Request["TypeId"] != null && Request["NewsTitle"] != null && Request["TypeName"] != null) { int TypeId = int.Parse(Request["TypeId"]); string NewsTitle = Request.Params["NewsTitle"].ToString(); this.TextSearchTitle.Text = Request["TypeName"].ToString(); DataLiStsearch.DataSource = NewsInfoCRUD.GetNewsParticular(PageNumber, TypeId, NewsTitle); DataLiStsearch.DataBind(); } else { Response.Write("<script language='javasript'>"); Response.Write("alert(请输入关键字或者选择类型)"); Response.Write("<script>"); } }
public void HomeBind() { _newsType = NewsInfoCRUD.GetNewsType(); this.DropNewsList.Items.Clear(); foreach (var item in _newsType) { this.DropNewsList.Items.Add(item.typeName); this.DropNewsList.DataValueField = item.typeId.ToString(); this.DropNewsList.DataTextField = item.typeName; this.DropNewsList.SelectedIndex = 0; this.DropNewsList.DataBind(); } //环球经济 NewsTypeId = 1; this.DetaListHqjj.DataSource = NewsInfoCRUD.GetNewsInfo(PageNumber, NewsTypeId); this.DetaListHqjj.DataBind(); //环球经济 //军事世界 NewsTypeId = 2; this.DataListJssj.DataSource = NewsInfoCRUD.GetNewsInfo(PageNumber, NewsTypeId); this.DataListJssj.DataBind(); //军事世界 //科学技术 NewsTypeId = 3; this.DataListKxjs.DataSource = NewsInfoCRUD.GetNewsInfo(PageNumber, NewsTypeId); this.DataListKxjs.DataBind(); //科学技术 //生活理财 NewsTypeId = 4; this.DataListShlc.DataSource = NewsInfoCRUD.GetNewsInfo(PageNumber, NewsTypeId); this.DataListShlc.DataBind(); //生活理财 //社会百态 NewsTypeId = 5; this.DataListShbt.DataSource = NewsInfoCRUD.GetNewsInfo(PageNumber, NewsTypeId); this.DataListShbt.DataBind(); //社会百态 //世界体育 NewsTypeId = 6; this.DataListSjty.DataSource = NewsInfoCRUD.GetNewsInfo(PageNumber, NewsTypeId); this.DataListSjty.DataBind(); //世界体育 //娱乐综艺 NewsTypeId = 7; this.DataListYlzy.DataSource = NewsInfoCRUD.GetNewsInfo(PageNumber, NewsTypeId); this.DataListYlzy.DataBind(); //娱乐综艺 }
public void SearchBind() { _newsType = NewsInfoCRUD.GetNewsType(); int TypeId = 0; string TypeName = ""; foreach (var item in _newsType) { if (this.DropNewsList.SelectedItem.Text == item.typeName) { TypeId = item.typeId; TypeName = item.typeName; } } string NewsTitle = this.TxtSearch.Text.Trim(); Response.Redirect("NewsSearchPage.aspx?TypeId=" + TypeId + "&TypeName=" + TypeName + "&NewsTitle=" + NewsTitle); }
public void PageBind() { _newsType = NewsInfoCRUD.GetNewsType(); this.DropNewsList.Items.Clear(); foreach (var item in _newsType) { this.DropNewsList.Items.Add(item.typeName); this.DropNewsList.DataValueField = item.typeId.ToString(); this.DropNewsList.DataTextField = item.typeName; this.DropNewsList.SelectedIndex = 0; this.DropNewsList.DataBind(); } if (Request["typeId"] != null && Request["name"] != null) { int typeId = int.Parse(Request["typeId"]); this.TextSearchTitle.Text = Request["name"]; this.DataLiStsearch.DataSource = NewsInfoCRUD.GetNewsMoreInfo(typeId); this.DataLiStsearch.DataBind(); } }