Reputation: 12700
Completely new to asp.net mvc... completely new to web apps so bear with me...
Lets say I have an Action on a controller that requires a specific piece of information, say an int Id value.
A view is rendered from this Action. This view contains a button which will take the user off to a new Action on another Controller.
On the view of this second Action, there is a link that will send them back to the original Action on the Controller. Obviously, I've lost the original Id value and therefore the information I need to render my original view. What do I need to be looking into to solve this? Are there techniques/patterns that could be used to help?
I know I can keep passing the value around but if the other controller doesn't actually need this value it seems wasteful. I think I'm probably approaching the problem the wrong way to be honest. Any help appreciated.
Upvotes: 0
Views: 81
Reputation: 16651
There are many ways you can achieve this. Some of them are :
<input type="hidden" name="n" value="v" />
Without knowing what exactly you are trying to do, it's hard to know best solution.
Upvotes: 0
Reputation: 48593
I know I can keep passing the value around but if the other controller doesn't actually need this value it seems wasteful.
But the second controller does need the id to function properly - as you've said, it needs the id to render the return link. Passing it around is the right thing to do.
Upvotes: 3