I am writing an ASP.NET custom control.
In my custom control code, I find a PlaceHolder control in the page like so:
this.myPlaceholder = Page.FindControl("placeholder1") as PlaceHolder;
Then, I render the placeholder as the output of the custom control:
protected override void Render(HtmlTextWriter output)
{
if (this.myPlaceholder != null)
{
this.myPlaceholder.RenderControl(output);
}
}
However, this causes the placeholder to be rendered in two places - in the custom control output (good) and in the original location in the page (bad).
Is there any way I can remove this placeholder from the page so it is only output inside the custom control?