Problem with datagrid and page indexing

  • Thread starter Thread starter Lauchlan M
  • Start date Start date
L

Lauchlan M

Hi

I have a grid that displays ok. I have activated page indexing, the code to
implement it is:

private void dGridSessionData_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
dGridSessionData.CurrentPageIndex = e.NewPageIndex;
nxDataAdapterSessionData.Fill(nxDataAdapterSessionData_DataSet,
"sessiondata");
dGridSessionData.DataSource = nxDataAdapterSessionData_DataSet;
dGridSessionData.DataMember = "sessiondata";
dGridSessionData.DataBind();
}

When I run it, the grid displays with say four pages. But when I click on
'4' to go to the last page, page 4, sure enough it goes to page 4, but now
it is page 4 out of 6 pages!

Any ideas on what might be causing this behaviour and how I should fix it?

Thanks!

Lauchlan M
 
Look in the Property Builder (right-click on the grid in design mode). How
many numeric pages do you have it set for? Do you see a "..." at the end
when you first look at the 4-pages?
 
Look in the Property Builder (right-click on the grid in design mode). How
many numeric pages do you have it set for?

What do you mean? I set it to 10 rows per page if that's what you mean.
Do you see a "..." at the end
when you first look at the 4-pages?

Well, say the data has 6 pages (there are page indexes for 6 pages), and I
click on the 6th page index, when it redraws the grid it then gives me 10
pages and the '...' . . .

Lauchlan M
 
Seems like your datasource increases. Do you see duplicated records after
paging?

Greetings
Martin
 
Back
Top