locked
How to Maintain Page State? RRS feed

  • Question

  • User258387678 posted

    Hi,

    I am using c# in my web application,i have few static as well as dynamic controls on my web page(Controlsample.aspx).

    I want to maintain the viewstate of all the controls contained in (Controlsample.aspx),in case if you are suppose to navigate to other page and when you come back to the page(Controlsample.aspx) all controls should persist there values which the user has entered.

    I am not using SessionState

    how can i achieve this task?

    Thanks in advnace

    - Hitesh

     

     

    Monday, October 22, 2007 5:25 AM

Answers

All replies

  • User-322220827 posted

    you would have to write the state of the page somewhere and reload it when the user navigates back as for where to write it you could use Session,SQL DB or even write it to file.

    Monday, October 22, 2007 5:40 AM
  • User214117797 posted

    You have a few options, create an object that represents the data structure of the ControlSample.aspx web page and save this to session or serialise it to a file, therefore you can repopulate the web page when the user comes back to it.

    Monday, October 22, 2007 5:44 AM
  • User-1091210821 posted

    Hi,

    I am using c# in my web application,i have few static as well as dynamic controls on my web page(Controlsample.aspx).

    I want to maintain the viewstate of all the controls contained in (Controlsample.aspx),in case if you are suppose to navigate to other page and when you come back to the page(Controlsample.aspx) all controls should persist there values which the user has entered.

    I am not using SessionState

    how can i achieve this task?

    Thanks in advnace

    - Hitesh

    Hi Hitesh,

    You will observe that, if you press the back button all the controls will have their viewstate preserved anyway and hence thats not an issue, however if you say went to another page from your current page and then in due course redirect the user back, then viewstate will merely recreate the control at particular locations etc..etc..i.e. with the UI stuff but not the content.

    If you want to preserve this stuff then you can either save this state in session as you are already aware and also use control state. You can also persist this on sql server somewhere as well by using serialization.

    Regards 

    Monday, October 22, 2007 6:15 AM
  • User258387678 posted

    Hi Sir, 

    would it be right to maintain 50 controls state in a session?in which 30 are dynamic and rest of controls are static.

    I want to load the controls state in the page load of that web page.

    I am not aware about Control State that i'll try

     - Hitesh

    Monday, October 22, 2007 6:46 AM
  • User-1091210821 posted

    you can consider implementing something like this http://www.eggheadcafe.com/articles/extendtextboxviewstate.asp

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 22, 2007 7:12 AM
  • User258387678 posted

    My problem is almost solved from this document.

    Thanks for your assistance.

    - Hitesh

    Monday, October 22, 2007 7:17 AM