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!

VN:F [1.9.3_1094]
Rating: 0.0/10 (0 votes cast)