//protected void Page_Load(object sender, EventArgs e) //{ // //} /// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { //get current sitemap node to determine page icon and title SiteMapProvider objSiteMapProvider = SiteMap.Providers["RootSiteMapProvider"]; System.Diagnostics.Debug.Assert(objSiteMapProvider != null); SiteMapNode objCurrentNode = objSiteMapProvider.CurrentNode; if (objCurrentNode != null) //This is for defaultErr.aspx which is not referenced as a node { //set page icon and title Page.Header.Title = Resources.Web.glossary.App_Name + " - " + objCurrentNode.Title; if (string.IsNullOrEmpty(PageTitle.Text)) { PageTitle.Text = objCurrentNode.Title; } if (string.IsNullOrEmpty(PageTitle.ImageUrl)) { PageTitle.ImageUrl = Icons.GetIcon32(objCurrentNode["image"]); } } //Display errors of postback events if (Page.Session[Constants.LastError] != null) //&& Page.IsPostBack { InfoBox.Type = InfoBoxType.Error; InfoBox.Text = BODisplay.Encode(Session[Constants.LastError]); Session[Constants.LastError] = null; } //Required to avoid "Script controls may not be registered before PreRender." base.OnPreRender(e); }
/// <summary> /// The PreRender event which occurs after page load /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { WebMasterPage objMasterPage = Page.Master as WebMasterPage; Page.Header.Title = Resources.Web.glossary.App_Name + " - " + this.GetLocalResourceObject("PageTitle").ToString(); InfoBox objPageTitle = objMasterPage.FindControl("PageTitle") as InfoBox; objPageTitle.ImageUrl = Icons.GetIcon32("errorreport.gif"); objPageTitle.Text = this.GetLocalResourceObject("PageTitle").ToString(); InfoBox objInfoBox = objMasterPage.FindControl("InfoBox") as InfoBox; objInfoBox.Type = InfoBoxType.Error; try { if (Session[Constants.LastError] != null) { objInfoBox.Text = BODisplay.Encode(Session[Constants.LastError]); Session[Constants.LastError] = null; } else { string errorCode = Context.Request.QueryString["e"]; int iHttpCode; bool bTry = Int32.TryParse(errorCode, out iHttpCode); if ((bTry) && (iHttpCode > 200) && (iHttpCode < 600)) { this.Response.StatusCode = iHttpCode; } objInfoBox.Text = this.GetLocalResourceObject(errorCode).ToString(); } } catch { objInfoBox.Text = this.GetLocalResourceObject("0").ToString(); } //Required to avoid "Script controls may not be registered before PreRender." base.OnPreRender(e); }