Perhaps the real question is whether that code is executing before the page has finished loading its controls and state.

What event does that code run in your user control?