Last post Nov 11, 2011 05:16 AM by yuspei_2000
Nov 17, 2009 11:49 AM|alvipeo|LINK
I created LocalizedPageBase class with overriden InitializeCulture:
protected override void InitializeCulture()
if (ContentManager.CurrentCulture == null)
ContentManager.CurrentCulture = WestMasterPage.CurrentCulture;
Debug.Assert(ContentManager.CurrentCulture != null, "Culture not initialized");
UICulture = ContentManager.CurrentCulture.Name;
Culture = ContentManager.CurrentCulture.Name;
System.Threading.Thread.CurrentThread.CurrentCulture = ContentManager.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = ContentManager.CurrentCulture;
Now, I use a MasterPage for my webforms. And I created my descendant MainPage (which uses that MasterPage) where I have an Image1 (standard Image control) and this Page_Load handler:
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack && !IsCallback)
Image1.ImageUrl = "...someUrl...";
But the problem is Image1 IS NULL here! I can't figure out why. If I remove overriden InitializeCulture() then Image1 point to an object.
Nov 18, 2009 10:52 AM|alvipeo|LINK
Am I the only one who has this problem?
May 27, 2010 02:05 PM|Scorp-D|LINK
No.. I get it too...
Is WestMasterPage your masterpage ?
It only happens to me when InitializeCulture is overridden and I call my masterpage inside it, like this:
object o = this.Master;
O is containing the correct partly initialized masterpage, and no exceptions is thrown, but all controls are Null when trying to access them in Page_Load.
In my particular case, I was able to move the code from InitializeCulture.
Nov 11, 2011 05:16 AM|yuspei_2000|LINK
I have the same problem and can't find the answer.