views:

18

answers:

1

In a .NET 4 web application I've set the property "renderAllHiddenFieldsAtTopOfForm" to "false" in the web.config. Unfortunately the hidden fields are still at the top.

Why is this? Does some other setting override it?

"pages" property in web.config: "pages" property in web.config

Screenshot of top of the form: Screenshot of top of the formide it?

+1  A: 

From the docs:

all system-generated hidden fields are rendered at the top of the page. This makes sure that the information in these fields is sent to the server even if a postback is performed before the page has finished loading. If RenderAllHiddenFieldsAtTopOfForm is set to false, performing a postback before the page has finished loading can cause an "Invalid postback or callback argument" error.

Although the property name indicates "all hidden fields," user-created hidden fields are not affected by settings for this property.

I'm not sure what you are attempting to accomplish here, but it doesn't look like you can do what you are wanting to. And, for that matter, I'm not sure it's a good idea even if you could.

Robert Greiner
risks aside, they are system generated, so it should work.
craigmoliver
If they are system generated then you probably don't have a say in where the controls are placed. I'm sure they default there whether that value is set to true or false.
Robert Greiner
according to MSDN (http://goo.gl/jHr8), that's what "renderAllHiddenFieldsAtTopOfForm" is for. Did you read the question or am I missing something?
craigmoliver
Either you're missing something or I am. I didn't see anything that suggests you can "force" the fields to the bottom of the page. Also, it says "in ASP.NET 3.5 SP1, all system-generated hidden fields are rendered at the top of the page." So all of the hidden fields get generated at the top of the page in 3.5 SP1 + and there is some other information for .net versions less than 3.5 SP1 (I see you are using 4.0 though, so that doesn't apply)
Robert Greiner
I'm missing something then, I read that wrong. Thanks!
craigmoliver
np, sorry it's not quite the answer you were hoping for.
Robert Greiner