I have an MVC 3 application containing a view with several html helper controls on it. For simplicity, assume there is a single textbox and and list control. The list control has an edit action link below it. The user clicks the link and is directed to
a different veiw where they can select from a list of options. After they select their options they are brought back to the original view page containing the textbox and the list control.
The problem I have is maintaining the data the user may have added to the textbox between the movement from the first view to the second view and back. If the user enters data in the textbox, clicks edit to select items in another view, then is directed
back to the original view, anything the user entered in the text box is lost.
What's the best way to preserve the user's data in this scenario without forcing a postback of the initial view?
Hi You can keep the data in the Global JSON Array. At each redirection you have to save the data in the JSON array and when comback to the home page you have to assign the textbox value from the saved JSON array.
kman0912
Member
2 Points
7 Posts
Maintain user data
Jun 28, 2012 01:57 PM|LINK
I have an MVC 3 application containing a view with several html helper controls on it. For simplicity, assume there is a single textbox and and list control. The list control has an edit action link below it. The user clicks the link and is directed to a different veiw where they can select from a list of options. After they select their options they are brought back to the original view page containing the textbox and the list control.
The problem I have is maintaining the data the user may have added to the textbox between the movement from the first view to the second view and back. If the user enters data in the textbox, clicks edit to select items in another view, then is directed back to the original view, anything the user entered in the text box is lost.
What's the best way to preserve the user's data in this scenario without forcing a postback of the initial view?
pon_prabhu
Participant
828 Points
185 Posts
Re: Maintain user data
Jun 28, 2012 02:03 PM|LINK
Hi You can keep the data in the Global JSON Array. At each redirection you have to save the data in the JSON array and when comback to the home page you have to assign the textbox value from the saved JSON array.
ignatandrei
All-Star
135047 Points
21654 Posts
Moderator
MVP
Re: Maintain user data
Jun 28, 2012 02:03 PM|LINK
Session /Cookies/ TempData.
kman0912
Member
2 Points
7 Posts
Re: Maintain user data
Jun 28, 2012 02:07 PM|LINK
Can you provide a simple example?