locked
How to maitain Page state RRS feed

  • Question

  • User-443760471 posted

    hello frnds,

    I have dropdownlists, Gridview in a Search Page. When user selects certain fields and clicks on search, it redircts the user to another page. When he clicks on cancel button in the 2nd page. I need to show the user earlier selection of data in the search page.

    How to cache or maintain the enitre page data, so that during navigations User can see the data which is already selected by him

    Please help me out

    thanks

    Monday, August 6, 2012 1:39 AM

Answers

  • User-578657687 posted

    Hi,

    How to cache or maintain the enitre page data, so that during navigations User can see the data which is already selected by him

    To maintain page statement, in the asp.net, you can use querytring, viewstate, cookie,hiddenfield, session, application, cache and profile. For your specific scenario, the query string, cookie and session should be good choice. When you redirect the user to another page, you can pass the selectedvalue of dropdownlist as querystring, or save the selectedvalue to cookie/session. Now I want to recommend this document about ASP.NET State Management to you:

    http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 12, 2012 11:39 PM

All replies

  • User-1944332692 posted

     If you do not need any server side processing after clicking 'Cancel Button', you can use JavaScript and write history.go(-1) onclick of the button. That will take you to the previous page and drop-down-list will show the last selected value.


    Monday, August 6, 2012 1:54 AM
  • User-8475372 posted

    Basically, any search criteria should not redirect the search results to another page (almost in all the cases). Please redefine your page in order to make sure that the search results will be shown in that page itself rather than another page as this increases the ease of access of your application. 

    If at all there is a strict requirement to follow that guideline, history.go in javascript will do it for you as it takes one page back of any browser(For this, you need to make sure that the javascript is enabled all the time on the client browser).. 

    Code smart... !!

    Monday, August 6, 2012 2:20 AM
  • User-578657687 posted

    Hi,

    How to cache or maintain the enitre page data, so that during navigations User can see the data which is already selected by him

    To maintain page statement, in the asp.net, you can use querytring, viewstate, cookie,hiddenfield, session, application, cache and profile. For your specific scenario, the query string, cookie and session should be good choice. When you redirect the user to another page, you can pass the selectedvalue of dropdownlist as querystring, or save the selectedvalue to cookie/session. Now I want to recommend this document about ASP.NET State Management to you:

    http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 12, 2012 11:39 PM
  • User481839292 posted

    Hi,

    You can go with the following approaches.

    1. Ideally search results should be shown on the page itself not on a new page, you can redesign the page and put the search controls in left side or in header as a user control .

    2. if you need to display the search results in a new page then you can show a Javasscipt/JQuery based pop up and show the results there so you need not to reset the search controls.

    3. If you strictly need to go with the approach that you are using currently then you can do this in two ways:

          1.  if search criterias you are passing through query string then from search form on cancel click you can again pass these parameters as query string back to the search controls form and set the controls status as per the passed parameters.

          2. If you are setting search parameters in session then you just reset the control's status based on the saved information.

    Tuesday, August 14, 2012 9:03 AM