//******************************************************* // // The Page_Load event handler on this User Control is // used to render a block of HTML or text to the page. // The text/HTML to render is stored in the HtmlText // database table. This method uses the ASPNET.StarterKit.Portal.HtmlTextDB() // data component to encapsulate all data functionality. // //******************************************************* private void Page_Load(object sender, System.EventArgs e) { // Obtain the selected item from the HtmlText table ASPNET.StarterKit.Portal.HtmlTextDB text = new ASPNET.StarterKit.Portal.HtmlTextDB(); SqlDataReader dr = text.GetHtmlText(ModuleId); if (dr.Read()) { // Dynamically add the file content into the page String content = Server.HtmlDecode((String)dr["DesktopHtml"]); HtmlHolder.Controls.Add(new LiteralControl(content)); } // Close the datareader dr.Close(); }
//**************************************************************** // // The Page_Load event on this Page is used to obtain the ModuleId // of the xml module to edit. // // It then uses the ASPNET.StarterKit.Portal.HtmlTextDB() data component // to populate the page's edit controls with the text details. // //**************************************************************** private void Page_Load(object sender, System.EventArgs e) { // Determine ModuleId of Announcements Portal Module moduleId = Int32.Parse(Request.Params["Mid"]); // Verify that the current user has access to edit this module if (PortalSecurity.HasEditPermissions(moduleId) == false) { Response.Redirect("~/Admin/EditAccessDenied.aspx"); } if (Page.IsPostBack == false) { // Obtain a single row of text information ASPNET.StarterKit.Portal.HtmlTextDB text = new ASPNET.StarterKit.Portal.HtmlTextDB(); SqlDataReader dr = text.GetHtmlText(moduleId); if (dr.Read()) { DesktopText.Text = Server.HtmlDecode((String)dr["DesktopHtml"]); MobileSummary.Text = Server.HtmlDecode((String)dr["MobileSummary"]); MobileDetails.Text = Server.HtmlDecode((String)dr["MobileDetails"]); } else { DesktopText.Text = "Todo: Add Content..."; MobileSummary.Text = "Todo: Add Content..."; MobileDetails.Text = "Todo: Add Content..."; } dr.Close(); // Store URL Referrer to return to portal ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); } }