move beginning of page writing into RenderBeginTag so we can properly override content in RenderContents

This commit is contained in:
Michael Becker 2024-08-11 10:13:01 -04:00
parent 94e3fcec40
commit 9e49f743f9

View File

@ -45,10 +45,7 @@ public class WebPage : Control
{
EnsureInitialized();
writer.WriteStartElement(TagName, "http://www.w3.org/1999/xhtml");
}
protected override void RenderContents(XmlWriter writer)
{
writer.WriteStartElement("head");
writer.WriteElementString("title", "Mocha Application");
@ -89,11 +86,19 @@ public class WebPage : Control
writer.WriteStartElement("form");
writer.WriteAttributeString("method", "POST");
}
protected override void RenderContents(XmlWriter writer)
{
foreach (Control control in Controls)
{
control.Context = Context;
control.Render(writer);
}
}
protected override void RenderEndTag(XmlWriter writer)
{
base.RenderEndTag(writer);
writer.WriteEndElement();
writer.WriteEndElement();