Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
903
Retrieving data from grid always gets page one values
posted

I am using this code in a WHDG

<ig:TemplateDataField Key="EditCol" Width="40px">
      <ItemTemplate>
         <asp:ImageButton ID="EditButton" runat="server"
             ImageUrl="~/images/button-pencil.gif" CommandName="EDIT" CommandArgument='<%# DataBinder.Eval(DirectCast(Container, Infragistics.Web.UI.TemplateContainer).Item, "Row.DataKey[0]") %>' />
   </ItemTemplate>
      <Header Text="Edit" />
  </ig:TemplateDataField>

I then check the value in my ItemCommand event

Protected
 Sub NewGrid_ItemCommand(sender As Object, e As Infragistics.Web.UI.GridControls.HandleCommandEventArgsHandles NewGrid.ItemCommand

Debug.Print e.CommandArgument

This shows the value I expect on page 1 of the grid but on subsequent pages it returns the equivalent value from page one of the grid.

I have previously tried other ways of getting data from the grid when it is on later pages but none of them work. They all return data from page one.
e.g. Following other threads I used a hidden field (gridRowIndextxt) to return the page number to ItemCommand. But if I set the grid to that page like this


NewGrid.GridView.Behaviors.Paging.PageIndex = gridRowIndextxt.Value
Dim RowIndex = e.CommandArgument        'Command Argument WebhierarchicalDataGrid WHDG is the RowIndex
Dim curRow As Infragistics.Web.UI.GridControls.ContainerGridRecord
curRow = NewGrid.GridView.Rows(RowIndex)

Looking at the currow it always has page one values.

Help please?