Below is a schematic of my code, the full thing would be too much. I hope it makes sense. I have a problem that in the DeleteRow event, trying to read the DataKey, the RowEventArgs always returns the value from the equivalent row on the first page of the grid even if I have paged further.
The way I do it may not be right (I am very open to suggestions) but it works for other webforms in my app where I am using an SQLDataSource rather than the WebHierarchichalDatSource I am using here.
I also thought it used to work here but somewhere along the line (maybe after 10.1?) (I am on version 10.2.20102.101) it stopped working. My users don't appear to have noticed yet!
An UltraWebGrid<ig:WebHierarchicalDataSource ID="WebHierarchicalDS1" runat="server"> <DataRelations> <ig:DataRelation ChildColumns="Transport Order ID" ChildDataViewID="SqlDataSource2_DefaultView" ParentColumns="Transport_Order_ID" ParentDataViewID="SqlDataSource1_DefaultView" /> </DataRelations> <DataViews> <ig:DataView ID="SqlDataSource1_DefaultView" DataMember="DefaultView" DataSourceID="SqlDataSource1" /> <ig:DataView ID="SqlDataSource2_DefaultView" DataMember="DefaultView" DataSourceID="SqlDataSource2" /> </DataViews></ig:WebHierarchicalDataSource' Code StructurePage_Load If not Postback LoadDataset endifEnd Page_LoadSub LoadDatset Set UltraWebGrid.DataSourceID UltrawebGrid.DataBindEnd Subsub PrepareDataset Build SelectCommand for SQLDataSource1End SubSub SelectionChanged LoadDataSetEnd SelectionChangedUltraWebGrid_DataBinding PrepareDataSetEnd SubUltraWebGrid_SortColumn LoadDataSetEnd SubUltraWebGrid_PageIndexChanged LoadDataSetEnd SubUltraWebGrid_DeleteRow(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.RowEventArgs) Handles UltraWebGrid.DeleteRow DeleteRowID = e.Row.DataKey 'Always Returns the DataKey from the first pageEnd DeleteRow
OK, it looks like this post is in the wrong forum, so it may appear in the Classic Controls section. I hadn't really noticed that the grids I use have become 'Classic'
After some further tests I see that the CurrentPageIndex is correct when DeleteRow is called. (I am actually testing in a CellClickButton event, but I have the same problem in both)
So the grid thinks it is on the right page it is just that the DataKeys set appears to be wrong. And it looks like the grid Datakeys set is populated with the Keys from the first page only.