I believe the issue here may be exactly that you're doing something to cause page output during Page_Load, which, according to the ASP.NET Page Lifecycle Overview is long before the rendering stage.
Ensure that you never do anything that could trigger page output until after the PreRender stage.