This is probably a quick fix, but I am writing to a HtmlTextWriter
in my HtmlHelper
and no matter what I try it is encoding the HTML so the output shows the markup.
Helper:
protected override void WriteHtml(System.Web.UI.HtmlTextWriter writer)
{
writer.WriteFullBeginTag("div");
writer.WriteEndTag("div");
base.WriteHtml(writer);
}
and it will out put this to the page: <div></div>
EDIT
I am calling it in the view like this:
@Html.SAIF().Toolbar().Items(items => {
items.Add().Action("Action");
... ...
})
Edit #2
OK, let's see if I can explain this a little better.
If I use ViewContext.Writer to write my helper to the stream, when using a syntax like this:
@Html.MyHelper
It outputs encoded HTML (e.g.) <div>Test Div</div>
= Not correct
If I use a syntax like this:
@{Html.MyHelper.Render();}
It renders correctly, meaning that it actually inserts the div into the DOM instead of displaying it as a string.
Make sense?