I have a an object view with data and a button on that view. The user can review the object info and click the button to go to a new view form whee he can enter info to create an item. My challenge is this, how would I attach the ID of the object on the previous view to associate it with and attach to the information they create and submit?
Share
This will create an a tag with querystring
?id=5. (You may replace the hardcoded 5 with the dynamic value in your view)Have a property to keep this value for your
ViewModel/Modelfor the create form.Read this in your GET
actionmethod which creates the second view and set the value of that property of the ViewModel/Model.And in your strongly typed view, Keep this value inside a hidden variable.
Now in your
HttpPostaction , you can get the Object Id from your POSTED model’s ParentId property