/// <summary> /// The Page_Load event handler on this User Control is used to /// obtain a DataReader of Article information from the Articles /// table, and then databind the results to a templated DataList /// server control. It uses the Rainbow.ArticleDB() /// data component to encapsulate all data functionality. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { // Obtain Articles information from the Articles table // and bind to the datalist control ArticlesDB Articles = new ArticlesDB(); if (PortalSecurity.IsInRoles(Settings["EXPIRED_PERMISSION_ROLE"].ToString())) { myDataList.DataSource = Articles.GetArticlesAll(ModuleID, Version); } else { myDataList.DataSource = Articles.GetArticles(ModuleID, Version); } myDataList.DataBind(); }
/// <summary> /// Raises OnInit event. /// </summary> /// <param name="e">The event arguments.</param> protected override void OnInit(EventArgs e) { // View state is not needed here, so we are disabling. - jminond this.MyDataList.EnableViewState = false; // Add support for the edit page this.AddText = "ADD_ARTICLE"; this.AddUrl = "~/DesktopModules/CommunityModules/Articles/ArticlesEdit.aspx"; // Obtain Articles information from the Articles table // and bind to the data list control var articles = new ArticlesDB(); this.MyDataList.DataSource = PortalSecurity.IsInRoles(this.Settings["EXPIRED_PERMISSION_ROLE"].ToString()) ? articles.GetArticlesAll(this.ModuleID, this.Version) : articles.GetArticles(this.ModuleID, this.Version); this.MyDataList.DataBind(); base.OnInit(e); }