I noticed several things when specifying SEO paging. In the ItemDataBound event, the ItemIndex does not correspond to the DataKeyValues. DataKeyValues always start with the first record of your datasource. The CurrentPageIndex is always 0. I'm not sure if this is a bug or something i am not doing correctly.
As a work around i had to write this code to get the datakey:
int currepagepageindex = 1;
int itemindex = 0;
if (Request.QueryString[GrdProducts.ClientID + "ChangePage"] != null)
currepagepageindex = int.Parse(Request.QueryString[GrdProducts.ClientID + "ChangePage"]);
itemindex = currepagepageindex * GrdProducts.PageSize - GrdProducts.PageSize + e.Item.ItemIndex;
if (itemindex < ((DataTable)GrdProducts.DataSource).Rows.Count)
{
inventoryid = (int)((DataTable)GrdProducts.DataSource).Rows[itemindex]["inventoryid"];
}
As a work around i had to write this code to get the datakey:
int currepagepageindex = 1;
int itemindex = 0;
if (Request.QueryString[GrdProducts.ClientID + "ChangePage"] != null)
currepagepageindex = int.Parse(Request.QueryString[GrdProducts.ClientID + "ChangePage"]);
itemindex = currepagepageindex * GrdProducts.PageSize - GrdProducts.PageSize + e.Item.ItemIndex;
if (itemindex < ((DataTable)GrdProducts.DataSource).Rows.Count)
{
inventoryid = (int)((DataTable)GrdProducts.DataSource).Rows[itemindex]["inventoryid"];
}