Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DataGrid Paging and CurrentPageIndex/ItemIndex Question
Message
De
18/03/2004 12:28:37
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
DataGrid Paging and CurrentPageIndex/ItemIndex Question
Divers
Thread ID:
00887585
Message ID:
00887585
Vues:
57
Hi All,

I have a web datagrid setup to allow paging. I have the following code in the PageIndexChanged event to store the current page index;
private void MmDataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
		{
			this.MmDataGrid1.CurrentPageIndex = e.NewPageIndex;
			this.BindControl(this.MmDataGrid1);
		}
I have the following code in the delete method;
private void MmDataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
		{
			// Get the row number to delete
			int RowToDelete = e.Item.ItemIndex;
			// Retrieve the previous Class DataSet
			DataSet tblProductStandard = (DataSet)Session["tblProductStandard"];
			// Tell the business object to delete the specified row
			this.otblProductStandard.Delete(tblProductStandard, RowToDelete);
			// Rebind the DataGrid
			this.BindControl(this.MmDataGrid1);
		}
The problem I'm having is that if I am on any page other than the first page and if I delete a record, it is actually deleting the record that is in the corresponding row on page 1. To clarify, if I'm on page 2 and delete the second row, what actually happens is that the second row from the first page is deleted.

I thought that setting the CurrentPageIndex would prevent/handle this. Apparently it is not. So does anyone know what else I need to do to get this working?

I'm also having similar issues with updating and sorting. But hey, one step at a time. <s>

Thanks!
Kendall Webb
Senior Software Engineer
MCAD.Net/MCSD.Net
Répondre
Fil
Voir

Click here to load this message in the networking platform