I've created a regular ASP.NET user control, including the ascx file. For example:
MyUserControl.ascx
MyUserControl.ascx.cs
Then I try to render the control manually, at runtime, using code similar to the following code:
var testMyUserControl = new MyUserControl();
var textWriter =
new HtmlTextWriter(
new System.IO.StringWriter(new StringBuilder()));
testMyUserControl.RenderControl(textWriter);
Console.Write(textWriter.InnerWriter.ToString());
Nothing that I put in the ASCX file seems to render - either static HTML or any .NET controls.
However if I override the Render() method in the code-behind and manually output content, it does render.
What am I missing here?