You can do the following if you want to call a method inside master page Level0 Master Page public partial class Root : System.Web.UI. MasterPage { public void AddError(string strWhen, string strMessage) { lblAlert. Text += "" + "Une erreur s'est produite " + strWhen + "'" + strMessage + "'"; } } // Level1 Master Page public partial class OneColumn : System.Web.UI.
MasterPage { public void AddError(string strWhen, string strMessage) { ((Root)Master). AddError(strWhen, strMessage); } } // Content Page public partial class _Default : System.Web.UI. Page { protected void Page_Load(object sender, EventArgs e) { ((OneColumn)Master).
AddError("test", "test"); } }.
You can do the following if you want to call a method inside master page. // Level0 Master Page public partial class Root : System.Web.UI. MasterPage { public void AddError(string strWhen, string strMessage) { lblAlert.
Text += "" + "Une erreur s'est produite " + strWhen + "'" + strMessage + "'"; } } // Level1 Master Page public partial class OneColumn : System.Web.UI. MasterPage { public void AddError(string strWhen, string strMessage) { ((Root)Master). AddError(strWhen, strMessage); } } // Content Page public partial class _Default : System.Web.UI.
Page { protected void Page_Load(object sender, EventArgs e) { ((OneColumn)Master). AddError("test", "test"); } }.
It works, but it is redundant. Thank you! – JMichelB Jul 12 at 19:37.
I finally found a workaround. Here's my personnal solution. /// /// Fonctions de gestion d'erreurs personnalisées.
/// public class ErrorHandler { static string errLog = HttpContext.Current.Server. MapPath("~/Logs/errors. Log"); /// /// Affiche dans la page qu'une erreur s'est produite et l'indique dans un /// journal.
/// Utiliser seulement si l'erreur est récupérable. /// /// Complète la chaîne "Une erreur s'est produite ". /// Un "." sera ajouté après.
Ex : "lors du chargement du calendrier" /// Le message d'erreur de l'exception. Sera encadré /// d'apostrophes. Static public void AddPageError(string strWhen, string strMessage) { string strPrefixe = "Une erreur s'est produite "; string strPage = HttpContext.Current.Request.Url.
AbsolutePath; MasterPage mpMaster = ((Page)HttpContext.Current. Handler). Master; using (TextWriter errFile = new StreamWriter(errLog, true)) { errFile.
WriteLine(DateTime.Now.ToString() + " - (" + strPage + ") - " + strPrefixe + strWhen + " : '" + strMessage + "'"); } Label lblAlert = (Label)((Page)HttpContext.Current. Handler). FindControl("lblAlert"); // La boucle suivante sert à remonter les master page pour vérifier si un Label avec un id lblAlert existe.
While (lblAlert == null) { if (mpMaster == null) return; lblAlert = (Label)mpMaster. FindControl("lblAlert"); mpMaster = mpMaster. Master; } // On ne veut pas continuer si le Label n'existe pas : Des erreurs se produiraient.
If (lblAlert == null) return; if (lblAlert. Text == "") { lblAlert. Text = "Cliquez pour faire disparaître.
"; } lblAlert. Text += "" + strPrefixe + strWhen + ".'" + strMessage + "'"; lblAlert. BorderWidth = Unit.
Parse("0.3em"); lblAlert. RenderControl(new HtmlTextWriter(HttpContext.Current.Response. Output)); } } Now I only have to call ErrorHandler.
AddPageError("", ""); from anywhere to call my errors.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.