JavaScript - returning and reloading a webform in asp net

Asked By Jonathan Haguewood on 21-Jun-05 03:28 PM
I'm coding an application and I'm encountering some difficulties with the javascript. 

I have a form that opens in a new window, the user selects some records from a list box, clicks ok and the form closes and reloads the parent form. The problem I'm encountering is that when the parent form is reloaded, it doesn't simply reload the form as it would the first time the page is opened. Instead, the page is reloaded based on the the last page load event from cache. This is causing a problem because it will execute every sub tha that was executed the last go around. 

For example: The user clicks a reset button that resets all the fields, the code executes and everything is reset. The user then clicks the "select multiple records" link which opens the "Select Multiple Records" form. The user selects a few records and clicks ok. The desired effect is that when the parent form reloads, a label shows that indicates that multiple records were selected. But instead, the page is reloaded based on the last page load event in the cache which includes the event. So the page is reset and nothing shows. 

Is there a way to reload the page without using the cache? Any help would be greatly appreciated. Thanks!

Here's my code:
            Dim strJScript As String = "<script language=""javascript"">"
            strJScript &= "window.opener.location.reload();"
            strJScript &= "window.close()"
            strJScript &= "</script" & ">"
            If (Not IsClientScriptBlockRegistered("clientScript")) Then
                RegisterClientScriptBlock("clientScript", strJScript)
            End If

Please define term "Cache"? - Asked By Peter Bromberg on 21-Jun-05 03:50 PM

Do you mean ViewState? Or are you specifically using Cache?  Understand the basic issue, but we all need a level playing field on definitions of terms or we're likely to go in circles here.
Asked By Jonathan Haguewood on 21-Jun-05 04:21 PM
I could be wrong, but I believe it uses the VSWebCache for the Project. Sorry for not being more specific. Thanks.

VSWebCache is just a folder - Asked By Peter Bromberg on 21-Jun-05 04:42 PM

that holds offline copies of your web projects. It hasn't anything to do with ASP.NET "Caching" at runtime.

What it sounds like is that your page is reloading based on its previous posted state and so you are having the ViewState (and whatever else) being restored to values you don't want. 

First thing I'd do is put some conditional code in the Page_Load handler like

    //do this, that and the other
        // do something else