Automatic globalization of the Label control

The PreRender event of the Label control allows to attach a method that can translate the value of the Text property. Connected with a resource or a database and used in a custom base class for Page or in a server control it's very easy to localize a website.

override protected void OnInit(EventArgs e)
{
  ctrl.PreRender += new System.EventHandler(Translator.TranslateLabel);
  ...

Comments are closed