Input hidden missing from post FormCollection

B3y steven 9/18/2009 4:10:00 AM

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!

Tags:

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered By BlogEngine Enhanced with Snapshots

About the author

Steven Hildreth Steven Hildreth
Proof that anyone can setup a blog.

E-mail me LinkedIn Profile

Send mail Sign in

Recent posts