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 void Add(
	DataPagerField 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.

void Page_Load(Object sender, EventArgs e)

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

  if (!IsPostBack)
    // Create a NextPreviousPagerField object to display
    // the buttons to navigate.
    NextPreviousPagerField pagerField = new NextPreviousPagerField();
    pagerField.ShowFirstPageButton = true;
    pagerField.ShowLastPageButton = true;
    pagerField.ButtonType = ButtonType.Button;

    // Add the pager field to the Fields collection of the
    // DataPager control.



.NET Framework
Available since 3.5
Return to top