|
-
Mar 12th, 2010, 09:36 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] BAck button makes screen not match datasource
I'm a bit confused on how to fix this issue. I have a page that displays a list of vehicles in a gridview that is populate with a datatable from a database. I have a search feature that the user can do to limit the results. So basically they type in a truck number and click search, and it goes and loads the data table with just those records that match and loads the gridview with that table. Each row of the gridview has a Show button.
The problem happens if the user hits the back button on their browser. They are now looking at the unfiltered gridview, but the browser thinks it is filtered. If I click Show on the 10th row, the browser thinks the gridview only has 1 row and throws an index out of range error. Same thing happens if I try to look at the bound datatable.
Both of the below (commented and uncomment through me the index out of range error)
Protected Sub gvVehicles_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvVehicles.RowCommand
Code:
If e.CommandName = "Show" Then
Dim oInfo As New clsVehicleInformation
Dim oSQL As New clsWPSMD
Dim oVehicleSearch As New clsVehicleSearch
'oInfo.strEquipmentID = DirectCast(gvVehicles.DataSource, _
' Data.DataTable).Rows(Convert.ToInt32(e.CommandArgument) + _
' (gvVehicles.PageSize * gvVehicles.PageIndex)).Item(0)
oInfo.strEquipmentID = gvVehicles.Rows(Convert.ToInt32(e.CommandArgument) + _
(gvVehicles.PageSize * gvVehicles.PageIndex)).Cells(0).Text
oSQL.LoadVehicleInfo(oInfo)
PopulateVehicleInfo(oInfo)
End If
End Sub
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Mar 12th, 2010, 09:57 AM
#2
Thread Starter
Frenzied Member
Re: [RESOLVED] BAck button makes screen not match datasource
Blah, me being stupid again and not having a not ispostback in my page_load, so nevermind...
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|