Get values of hidden fields in controller (ASP.NET MVC)
Can I reach the 开发者_如何学Govalue of hidden fields in controller action ? And how ? Do I put it in the model somehow ?
Thank you
EDIT: some code example how to store something in hidden field and retrieve it on postback would be appreciated.
Hidden fields are just like any other form fields when you get to the POST action being sent to the server. There's nothing that makes them special outside of their display (or lack thereof, rather) in the browser. Thus, they should be accessible in much the same way you currently access other form fields.
How do you currently access other form fields? If they're just mapped to a model which is being passed into the controller action, then hidden fields should be mappable just the same.
Conversely, you should be able to manually access any HTTP POST data from HttpContext and the Request object.
精彩评论