See Message ID 762569
There is a DataKey value in the web data grid that might help you to always get the right record.
>Hi! I have a grid w/ 3 columns that only shows 15 rows per page. 1 - "select" button, 2 - Account code, 3 - Cross Reference. The user clicks the select button to bring an account code back to a previous screen. Currently, this works if the user doesn't page. If a user pages and then clicks "select" it picks up the value of the account for the correct row, but always the value of the account displayed in that row on page 1. Here is my code:
> Dim l_nrow As Integer
> l_nrow = e.Item.ItemIndex
> Dim l_ncol As Integer = 1
> Dim l_nseq As Decimal = CDec(Me.grdAcct.Items(l_nrow).Cells(l_ncol).Text)
> If l_nseq = 0 Then
> Me.lblAcct.Visible = True
> Else
> Me.lblAcct.Visible = False
> Session("v_cacct") = l_nseq
> Page.Response.Redirect("fabalrev.aspx")
> End If
>
>***l_nrow pulls the correct grid record, but not the correct record in the dataset. How can I change this code to function properly?
Hector Correa