Results 1 to 2 of 2

Thread: "Webpage has expired" after sorting a Gridview and clicking the Back button

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2015
    Posts
    10

    Question "Webpage has expired" after sorting a Gridview and clicking the Back button

    Hello,

    I am using VB 2102 in my current project, and I've come across these two scenarios:

    Here (don't ask me why) asynchronous calls are not being used, so I'm using the classic GridView to show a list of items. Each of them has a Detail.
    The Grid can be sorted and paginated without much trouble. However, after sorting/paginating, clicking on one of the records to see its details and then clicking on the Back button, the original Grid page shows a "Webpage has expired" warning. However, when I get into the detail, make a PostBack in that page, and then hit Back twice to return to the Grid page, the page makes all its process of retrieving data an so on.

    To avoid that I read somewhere that using the lines that I mention below would do the trick, but so far the behavior of the system is the same (the "Webpage has expired" thing). Of course, hitting F5 solves the problem, but it's of no use if the user hits F5 every time they return to the Grid page.

    Code:
    Response.Cache.SetNoStore()
            Response.Cache.AppendCacheExtension("no-cache")
            Response.Expires = 0
    
            'If Not IsPostBack Then   'Commented as to let the page recharge the data for the GridView
                   
            'End If

    What am I doing wrong or what am I missing? It's not exactly a life-or-death issue but I haven't found an information on this particular case.

    Every help will be very much appreciated.

    Thank you!
    -oishii

  2. #2
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,423

    Re: "Webpage has expired" after sorting a Gridview and clicking the Back button

    Quote Originally Posted by oishii View Post
    Hello,
    I'm using the classic GridView to show a list of items. Each of them has a Detail.
    The Grid can be sorted and paginated without much trouble. However, after sorting/paginating, clicking on one of the records to see its details and then clicking on the Back button, the original Grid page shows a "Webpage has expired" warning. However, when I get into the detail, make a PostBack in that page, and then hit Back twice to return to the Grid page, the page makes all its process of retrieving data an so on.
    Every help will be very much appreciated.

    Thank you!
    -oishii
    Hi Oishii, I've never used GridView so what I'm about to suggest may not be possible.

    If all the 'records' are in the same format, or in one of just a few formats, you might consider making a separate Form, or Forms to display the data.
    Using the 'Click' Subroutine for the record as you presumably do now would just call the relevant Form (e.g. all your code followed by: Form2.Show) and populate it with the data you want to show. Your code could include 'Me.Hide' to hide Form1,

    Each form could have a 'Back Button'...
    vb.net Code:
    1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    2.           Me.Hide
    3.           'If you've hidden Form1
    4.           Form1.Show
    5.     End Sub
    ...which would revert back to the original Form1.

    Poppa.

    PS.
    I'm sorry you've had to wait so long for any sort of an answer, usually the guys in this forum are very good.
    Pop.
    Last edited by Poppa Mintin; Aug 3rd, 2015 at 07:24 PM.
    Along with the sunshine there has to be a little rain sometime.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width