locked
Input data is lost between pages RRS feed

  • Question

  • User1459065186 posted

    Hi, 

    Apologies in advance, I am very new to ASP.Net and so this question maybe trivial, however I have searched high and low and can not seem to find the solution...

    so my application has 2 pages...

    1. A Form - (Users input values into this form via txtBoxs, radioButtons etc..)

    2. Guidance - (the user can refer to this page if they need help with how to answer the questions on the first page)

    PROBLEM - when ever a user selects the guidance page for assistance (via the NavigationMenu built into the master page (Site.master)) and then selects the Form page to go back to populating the form they loose all the data they had previously entered, how do I stop this from happening?

    I think I have enables viewstatemode on all fields within my first page (Form) however i'm still having this issue, any help would be most appreciated.

    Thanks in advanced 

    Frank 

    Monday, May 2, 2016 7:00 PM

Answers

  • User-491950272 posted

    The problem you are confronting can be either solve by:

    • (Recommended) Don't use a whole Guidance page for answers, instead use a small label and make them available upon receiving focus using Angular or jQuery.
    • If you still want to follow this way of solving problem, you can cached the data in all of the inputs fields in the local storage using available form save state jQuery plugins such as this
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 2, 2016 7:43 PM

All replies

  • User-491950272 posted

    The problem you are confronting can be either solve by:

    • (Recommended) Don't use a whole Guidance page for answers, instead use a small label and make them available upon receiving focus using Angular or jQuery.
    • If you still want to follow this way of solving problem, you can cached the data in all of the inputs fields in the local storage using available form save state jQuery plugins such as this
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 2, 2016 7:43 PM
  • User1459065186 posted

    Thank you. 

    I did originally think about your recommended option, however the notes I need to display are quite extensive, and when I put a label in to display this data the label pushed all of my other txtboxes out of place - is there an easy way to have these labels on top of existing txtboxes(so my current txtboxes stay in place) but are only visible when receiving focus?   

    Monday, May 2, 2016 8:14 PM
  • User36583972 posted

    Hi Frank369,

    As far as I know, when the page postpack, all the controls are initialized. So, you will lose all the data. I suggest you can try the following suggestions.

    1: Use Popup Window in ASP.Net

    If use need help with how to answer the questions on the first page, you can pop up a window to them.

    You can refer the following links.

    http://stackoverflow.com/questions/6996499/about-popup-window-in-asp-net

    http://demos.telerik.com/aspnet-ajax/window/examples/modalpopup/defaultcs.aspx

    2: Use Session to store the data that use had previously entered. When go back to populating the form and load the data again.

    Exploring Session in ASP.NET:

    http://www.codeproject.com/Articles/32545/Exploring-Session-in-ASP-Net

    Best Regards,

    Yohann Lu

    Tuesday, May 3, 2016 2:44 AM
  • User-1355486065 posted

    You don't really need to to save the state,

    As few notes can be implemented to achieve your scenario

    1.  Make a popup which indicates guidance page's content.
    2.  Make a small labels which can be put right to the textboxes. obviously you will have to make the designing comfortable
    Wednesday, May 4, 2016 6:47 AM
  • User1459065186 posted

    Thanks guys.

    I went with labels that popped up when in focus. 

    Wednesday, May 4, 2016 2:44 PM