I'm trying to iterate through a formview and set the pageindex to the page that the record is found on, but the pageindex refuses to let itself be set. . . looking at the debugger it sets to the correct thing, and then resets back to the number it originally was before going into the loop. .. my code:
Protected Sub getNavPage(ByVal participantID As String)
Dim x As Integer
fvRecruitment.PageIndex = 0
fvRecruitment.DataBind()
Dim iCurIndex As Integer = 0
For x = 0 To Me.fvRecruitment.PageCount - 1
fvRecruitment.PageIndex = iCurIndex + x
fvRecruitment.DataBind()
Dim userName As String = DirectCast(Me.fvRecruitment.FindControl("ParticipantIDTextBox"), TextBox).Text
userName = userName.Trim
If userName = participantID Then Exit For
Next
Session("PID") = Me.fvRecruitment.PageIndex
can anyone see where I'm going wrong?
Protected Sub getNavPage(ByVal participantID As String)
Dim x As Integer
fvRecruitment.PageIndex = 0
fvRecruitment.DataBind()
Dim iCurIndex As Integer = 0
For x = 0 To Me.fvRecruitment.PageCount - 1
fvRecruitment.PageIndex = iCurIndex + x
fvRecruitment.DataBind()
Dim userName As String = DirectCast(Me.fvRecruitment.FindControl("ParticipantIDTextBox"), TextBox).Text
userName = userName.Trim
If userName = participantID Then Exit For
Next
Session("PID") = Me.fvRecruitment.PageIndex
can anyone see where I'm going wrong?