I have to deal with an ASP.NET project in which i have to support localization and translation. Change of colture may happen only in InitializeCulture method of Page object and not on MasterPage.
Usually when i have to deal with common elements (header/footer) i put them in MasterPage but doing so prevent me to properly localize those elements. So i am intereseted in understand how to template a page using a common base page that will be derived by all other pages (a sort of MasterPage).
I have found this article that explain clearly how to handle such situation, but i think is a bit outdated : https://www.codeproject.com/Articles/2915/ASP-NET-Page-Templates-Using-Inheritance
So i would ask if there is a better approach or technology to achieve my goal.
Here a simple demo of how to send a variable to the Master Page. Put a public property in the Master named
Language
.Then add a property for the Master in the normal page and cast
Page.Master
to your Master Page's partial class (Site1
by default).Then you can access
Language
in the Master from the Page.