I've got a form view, and want to iterate through its pages, checking the value of a label on the control. But even though I set the pageindex in the loop, I only get the label.text of the 1st page for the entire loop:
For x = 0 To formView1.PageCount - 1
Me.formView1.PageIndex = x
Dim userName = DirectCast(formView1.FindControl("usernameLabel"), Label).Text
userName = userName.Trim
If userName = txtSearch.Text Then
lblResults.Text = userName + " matches " + DirectCast(formView1.FindControl("usernameLabel"), Label).Text + ". Page Num: " + x
End If
Next
Can someone please tell me how I can iterate through the pages/where I'm going wrong?
For x = 0 To formView1.PageCount - 1
Me.formView1.PageIndex = x
Dim userName = DirectCast(formView1.FindControl("usernameLabel"), Label).Text
userName = userName.Trim
If userName = txtSearch.Text Then
lblResults.Text = userName + " matches " + DirectCast(formView1.FindControl("usernameLabel"), Label).Text + ". Page Num: " + x
End If
Next
Can someone please tell me how I can iterate through the pages/where I'm going wrong?