I am trying to build a 1.0 version for a web application, and I want to build the first preview version without any javascript/ajax etc. which I plan to add later. I am having problems with little complicated forms that have many options.
For example, if it was and order form where user could add and remove products, add and remove services, type in messages and check options but all on single page and in the submit the order. Now my problem is with keeping the form’s state between the requests.
What would be the best way to keep the form’s viewmodel state? Lets say when user adds/removes a product to their orde
r would I have to pass the whole viewmodel to controller’s AddProdcut()/RemoveProduct() method every time and then return the updated viewmodel? Any examples, links and advices would be greatly appreciated.
Edit: I just discovered Session and TempData, are these apropriate for this kind of problem?
WebForm
what you do is create model for the form eg:
And add the information to ItemsToSave collection. that will be responsible to keep the data.
after
In controller you do this
}