Pausing page rendering at a certain point

I don’t know if this will be useful to anyone else but I thought this was kind of a neat trick for messing around with ASP.NET page rendering for debugging purposes.

My problem was I wanted to stop the rendering of a page at a certain point so I could see how the scripts were reacting when the user was interacting with a page that hadn’t completely rendered.

I couldn’t just put a break point into the page because the place I wanted the rendering to pause was deep within a web control that I didn’t have the source too. Doing this would have also locked up the browser and I wanted to actually be able to interact with the unfinished page.

I also just couldn’t make the rendering take a really long time because I wanted to pause the rendering between two controls.

I actually ended up with a pretty simple solution. I just created a modified Label control that flushed the output to the browser and then paused the thread rendering for a certain amount of time. The great thing about using the control meant I could just put the control in the page where I wanted the output to pause and I didn’t need to think of inventive ways to slow the rendering down.

If anyone else is having this problem, here’s the code for the control that I used:

public class PauseControl : Label
	private int _pause;
	public PauseControl()
	{ }

	protected override void Render(HtmlTextWriter writer)	{
		writer.WriteLine("Pausing render..");
		writer.WriteLine("Resuming render..");
		base.Render (writer);

	public int Pause
		get { return _pause; }
		set { _pause = value; }
Posted on 07 Apr 06 by Helen Emerson (last updated on 07 Apr 06).
Filed under ASP.NET, Javascript, Server controls