Input hidden missing from post FormCollection

I futzed around trying to get my hidden selected ID to be in the FormCollection object posted to my ASP.NET MVC controller.

I could not for the life of me figure out why it was not in the collection.

The input was defined like this;

<input id=”pkid” type=”hidden” value=”15″ />

Finally after looking around I noticed it was missing the ‘name’ attribute.

<input id=”pkid” name=”pkid” type=”hidden” value=”15″ />

After that the hidden was in the AllKeys and I could get the value, perhaps

widely known but it messed with me for a bit.

Enjoy!

One thought on “Input hidden missing from post FormCollection”

Leave a Reply