Hi, problem solved. All I needed to do was rebind the grid during the grids
PageIndexChanging event and then set the pageindex to the new pageindex as
follows:
Me.SearchGrid.DataBind()
Me.SearchGrid.PageIndex = e.NewPageIndex
Julia
"Julia B" wrote:
> Hi all
>
> I've got a gridview in a Visual Studio 2005, .NET version 2.0 web app, which
> displays many records. The grid's AllowPaging and AllowSorting properties are
> set to true with the grid displaying 10 records per page.
>
> There is a buttonfield column in the gridview which fires the grid
> rowcommand event as follows:
>
> Dim index As Integer
> Dim selectedRow As GridViewRow
> Dim filePath As String
> 'find the serial number of the record and open its change history
> index = Convert.ToInt32(e.CommandArgument)
> selectedRow = Me.SearchGrid.Rows(index)
> Dim serialNumber As String = selectedRow.Cells(3).Text
> Response.Redirect("ChangeHistory.aspx?SN=" & serialNumber)
>
> This supposedly opens another page in the application based on the record
> selected. If the user does this on the first page of the grid (i.e. the first
> 10 records) this works fine. However if the user sorts the records or goes to
> another page, when they click on the button field, the record that opens is
> one from the first page of the grid. The sort and page change don't seem to
> be recognised by the grid even though the user can see the change.
>
> Any ideas on what I need to do?
>
> Thanks
> Julia
|