I'm experiencing the exact opposite problem of the poster of this question: Why isn't "renderAllHiddenFieldsAtTopOfForm" not working?
I have explicitly set renderAllHiddenFieldsAtTopOfForm
to true:
<system.web>
<pages renderAllHiddenFieldsAtTopOfForm="true" />
</system.web>
Nonetheless, the rendered output contains two distinct sections containing the system-generated hidden fields: one at the top, and one at the bottom of the form:
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE4NDI1MTc3MzRkZI7H1ncHbGpdCuTIWztffomjhuKqOlUg2/NLTSuTAcPt" />
</div>
<div class="aspNetHidden">
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C2EE9ABB" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEdAATsr4X0euI6bC1nyD5GTh1SVvvE46VZo4PgfZC+nBCfTprQreIcKZCPCAR/ghE+h144RSSJ+WpNEsH2OOfrgDPYSZR3/cXf22QHuxsfDnv9/WdF+DPQdHKniJorPN8Mw6c=" />
</div>
Can anyone explain why this is happening?
The pertinents: This is an ASP.NET 4.5 application running under IIS 7, written in VB.NET built with Visual Studio 2013. This behavior can be observed on every page, and happens whether I remove the renderAllHiddenFieldsAtTopOfForm
setting or not, or if I set its value to true
or false
.
According to Reference Source, renderAllHiddenFieldsAtTopOfForm property is only honored when InnerWriter is HttpWriter.
Can you check if you are giving a different writer to the Render method?
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
base.Render(new MyHtmlTextWriter()); // <<<----
}