What's Happening When I Click Refresh?

R

Ross Culver

ASP 2.0; VS2005; IIS 6.0; textbox & gridview in multiview, in AJAX updatepanel

After entering keywords into a textbox and clicking a button, a gridview is populated with applicable records. The parameter for the underlying query is a session variable populated when the button was clicked.

That works fine.

When the user selects one of the returning rows of the gridview he is redirected to another aspx page. When the user returns to the previous page by clicking the browser back button the multiview active grid is supposed to be set back to the one with the gridview on it based on the session variable not being empty.

This worked fine until about a week ago. Now, in order to get the multiview activeview to be set back to the view with the grid on it, I have to click the refresh button. As far as I know, nothing has been changed in the application. FYI, when running the application on the server using the local files and ASP.Net development server, the page does what it's supposed to do. But the published version does not.

Thanks for any help and time in advance.

Ross

Below is the code:


Protected Sub Page_InitComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.InitComplete

Try

If Session.IsNewSession = True Then

SetParameters()

Refresh()

Else

'If there is a value in the QuickSearchPhrase session variable, do a search no matter what.

If CType(Session.Item("QuickSearchPhrase"), String) <> "" And CType(Session.Item("QuickSearchPhrase"), String) <> Nothing Then

Me.txtQuickSearch.Text = CType(Session.Item("QuickSearchPhrase"), String)

Session.Item("TargetView") = 1

Me.sqlQuickSearch.DataBind()

Me.mvBody.ActiveViewIndex = 1

Me.gvQuickSearch.PageIndex = CType(Session.Item("GridPageNo"), Integer)

Me.gvQuickSearch.SelectedIndex = -1

SetPagingLabels()

Else

'CurrentPage Action?

If CType(Session.Item("CurrentPage"), Boolean) = True Then

If CType(Session.Item("Action"), String) = "Back" Then

'Go to the previous view.

Me.mvBody.ActiveViewIndex = CType(Session.Item("OriginView"), Integer)

Else

'Go to the defined view.

Select Case CType(Session.Item("TargetView"), Integer)

Case 0

Refresh()

Case 1

'This should actually never happen.

'Me.txtMessage.Text = "This should never happen"

Refresh()

Case 2

Me.mvBody.ActiveViewIndex = 2

Case 3

Me.mvBody.ActiveViewIndex = 3

End Select

End If

Else

'Go to the defined view

Select Case CType(Session.Item("TargetView"), Integer)

Case 0

Refresh()

Case 1

'This should actually never happen.

Me.txtQuickSearch.Text = CType(Session.Item("QuickSearchPhrase"), String)

Me.sqlQuickSearch.DataBind()

Me.mvBody.ActiveViewIndex = 1

Me.gvQuickSearch.PageIndex = CType(Session.Item("GridPageNo"), Integer)

Me.gvQuickSearch.SelectedIndex = -1

SetPagingLabels()

Me.txtMessage.Text = "Click the 'Home' button above to refresh this page."

Case 2

Me.mvBody.ActiveViewIndex = 2

Case 3

Me.mvBody.ActiveViewIndex = 3

End Select

End If

End If

End If

Catch ex As Exception

Me.txtMessage.Text = "InitComplete: " & Err.Description

End Try

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top