I am building a ASP.NET MVC webapplication and have a question:
Say that I have a strongly typed view, when hitting submit the object(of the strongly type) will be filled and sent to the server.
Now say that one of the properties of the strongly typed is not used in the form, instead I need to set this with javascript if the user press a button (not submit button).
How do I do this?
As I understand it, you want to assign a value to the property when a button is pressed?
Add it as a hidden input (sample uses Razor view engine):
@Html.HiddenFor(model => model.TheProperty)Create a small jquery script: