DataPagerFieldCollection.Add Method (DataPagerField)

 

Appends the specified DataPagerField object to the collection.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

Public Sub Add (
	field As DataPagerField
)

Parameters

field
Type: System.Web.UI.WebControls.DataPagerField

The object to append to the collection.

The DataPagerField object is added to the end of the collection.

The following example shows how to use the Add method to add a NextPreviousPagerField object to a DataPager control.

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

  ' Dynamically generated field pagers need to be created only 
  ' the first time the page is loaded.

  If Not IsPostBack Then
    ' Create a NextPreviousPagerField object to display
    ' the buttons to navigate.
    Dim pagerField As New NextPreviousPagerField()
    pagerField.ShowFirstPageButton = True
    pagerField.ShowLastPageButton = True
    pagerField.ButtonType = ButtonType.Button

    ' Add the pager field to the Fields collection of the
    ' DataPager control.
    ContactsDataPager.Fields.Add(pagerField)
  End If

  ContactsListView.DataBind()

End Sub

.NET Framework
Available since 3.5
Return to top
Show: