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