Antpit 0 Newbie Poster

Hi

I have a Formview control on an aspx page. I want to display labels to say something like record 1 of 5 and total number of records found.

Here is the code (from the MSDN Site) that does not raise any errors but the labels stay blank. Thanks

<script runat="server">

     Sub FormView1_DataBound(ByVal sender As Object, ByVal e As EventArgs)
 ' Get the pager row.
         Dim pagerRow As FormViewRow = FormView1.BottomPagerRow

         ' Get the Label controls that display the current page information 
         ' from the pager row.
         Dim pageNum As Label = CType(pagerRow.Cells(0).FindControl("PageNumberLabel"), Label)
         Dim totalNum As Label = CType(pagerRow.Cells(0).FindControl("TotalPagesLabel"), Label)

         If pageNum IsNot Nothing And totalNum IsNot Nothing Then

             ' Update the Label controls with the current page values.
             Dim page As Integer = FormView1.PageIndex + 1
             Dim count As Integer = FormView1.PageCount

             pageNum.Text = page.ToString()
             totalNum.Text = count.ToString()
    
         End If

     End Sub
</script>



<pagertemplate>   
          <table width="100%">
            <tr>
              <td>
                <asp:linkbutton id="PreviousButton"
                  text="<"
                  commandname="Page"
                  commandargument="Prev"
                  runat="Server"/>
                <asp:linkbutton id="NextButton"
                  text=">"
                  commandname="Page"
                  commandargument="Next"
                  runat="Server"/> 
              </td>
              <td align="right">                
                Page <asp:label id="PageNumberLabel" runat="server"/> 
                of <asp:label id="TotalPagesLabel" runat="server"/>                
              </td>
            </tr>
          </table>          
        </pagertemplate>