derAllHiddenFieldsAtTopOfForm配置设

derAllHiddenFieldsAtTopOfForm配置设

本文介绍了为什么renderAllHiddenFieldsAtTopOfForm配置设置忽略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到这个问题的海报完全相反的问题:
Why是不是" renderAllHiddenFieldsAtTopOfForm"不工作?

I'm experiencing the exact opposite problem of the poster of this question:Why isn't "renderAllHiddenFieldsAtTopOfForm" not working?

我已经明确地设置 renderAllHiddenFieldsAtTopOfForm 为true:

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?

该pertinents:这是一个ASP.NET 4.5应用程序IIS 7下运行,写在VB.NET与Visual Studio 2013可以在每个页面上可以观察到这种行为建成,并发生了,我是否删除 renderAllHiddenFieldsAtTopOfForm 设置与否,或者如果我将其值设置为真正

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.

推荐答案

据的,renderAllHiddenFieldsAtTopOfForm属性仅兑现时InnerWriter是HttpWriter。

According to Reference Source, renderAllHiddenFieldsAtTopOfForm property is only honored when InnerWriter is HttpWriter.

您可以检查,如果你是给不同的作家Render方法?

Can you check if you are giving different writer to Render method?

protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
    base.Render(new MyHtmlTextWriter()); // <<<----
}

这篇关于为什么renderAllHiddenFieldsAtTopOfForm配置设置忽略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 08:28