protected void gvPageIndexChanging(Object sender, GridViewPageEventArgs e) { gvNewsAndViews.PageIndex = e.NewPageIndex; gvNewsAndViews.DataBind(); NewsAndViews newsDescription = new NewsAndViews(); lblArticleDes.Text = GetArticleDescription(newsDescription.GetAllNewsAndViews()[e.NewPageIndex * 10].ArticleId); UpdatePanel2.Update(); }
protected void Page_Load(object sender, EventArgs e) { NewsAndViews newsAndViews = new NewsAndViews(); List<NewsAndViews> listWatchOut = new List<NewsAndViews>(); listWatchOut = newsAndViews.GetAllNewsAndViews(); //Remove all other News Wire data above 5 records. //TO DO : Try to configure the number of records to display in web.config if (listWatchOut.Count > 7) listWatchOut.RemoveRange(6, listWatchOut.Count - 7); NewsandViewsRepeater.DataSource = listWatchOut; NewsandViewsRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { NewsAndViews newsAndViews = new NewsAndViews(); List<NewsAndViews> listNewsAndViews = newsAndViews.GetAllNewsAndViews(); gvNewsAndViews.DataSource = listNewsAndViews; gvNewsAndViews.DataBind(); NewsAndViews newsDescription = new NewsAndViews(); newsDescription.ArticleId = 1; NewsAndViews newsDescription1 = new NewsAndViews(); newsDescription1 = newsDescription.GetAllNewsAndViewsById(); lblArticleDes.Text = newsDescription1.ArticleDesc; }
protected void Page_Load(object sender, EventArgs e) { if(this.Request.QueryString["SelId"] != null) selectedArticleId = this.Request.QueryString["SelId"].ToString(); NewsAndViews newsAndViews = new NewsAndViews(); List<NewsAndViews> listNewsAndViews = newsAndViews.GetAllNewsAndViews(); gvNewsAndViews.DataSource = listNewsAndViews; gvNewsAndViews.DataBind(); NewsAndViews newsDescription = new NewsAndViews(); if (!string.IsNullOrEmpty(selectedArticleId)) { newsDescription.ArticleId = Convert.ToInt32(selectedArticleId); } else { newsDescription.ArticleId = listNewsAndViews[0].ArticleId; gvNewsAndViews.Rows[0].BackColor = System.Drawing.Color.LightGray; } NewsAndViews newsDescription1 = new NewsAndViews(); newsDescription1 = newsDescription.GetAllNewsAndViewsById(); lblArticleDes.Text = newsDescription1.ArticleDesc; }