DataPagerFieldCollection.Add(DataPagerField) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Appends the specified DataPagerField object to the collection.
public:
void Add(System::Web::UI::WebControls::DataPagerField ^ field);
public void Add (System.Web.UI.WebControls.DataPagerField field);
member this.Add : System.Web.UI.WebControls.DataPagerField -> unit
Public Sub Add (field As DataPagerField)
Parameters
- field
- DataPagerField
The object to append to the collection.
Examples
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.
ContactsDataPager.Fields.Add(pagerField);
}
ContactsListView.DataBind();
}
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
Remarks
The DataPagerField object is added to the end of the collection.
Applies to
See also
Colaborați cu noi pe GitHub
Sursa pentru acest conținut poate fi găsită pe GitHub, unde puteți, de asemenea, să creați și să consultați probleme și solicitări de tragere. Pentru mai multe informații, consultați ghidul nostru pentru colaboratori.