In a MVC 3 application i need to be able to part creation view in 2 different parts, because of some folder creation logic.On first view i have a textbox with Project Name, on click of next button i need to create folder for that project, and i need a way to get that project name folder on my next view in some way. Right now i press next and i loose project Name, and i cant get it again.
On internet there are plenty of places where they implement it the same way, but i cant figure out how to do that.
Any solutions on how to presist model?
You could use a hidden field in the second view that will contain the project name that was entered in the first view. That way when you submit this second form you will get the project name and the project folder.
Another possibility is to store the value that was entered in the first view somewhere on the server (database, session, …)
UPDATE:
As request in the comments section here’s an example using a hidden field.
First view:
then a controller action to which this first step will be submitted:
and then you will have a second controller action that will serve the second view:
you will then have a corresponding view:
which will post to the final action: