Suggerisci traduzione
 
Altri utenti hanno suggerito:

progress indicator
Nessun altro suggerimento.
Valuta il contenuto e lascia un commento
Comprimi tutto/Espandi tutto Comprimi tutto
Visualizza contenuto:  affiancatoVisualizza contenuto: affiancato
.NET Framework Class Library
DataPager Class

Provides paging functionality for data-bound controls that implement the IPageableItemContainer interface, such as the ListView control.

System..::.Object
  System.Web.UI..::.Control
    System.Web.UI.WebControls..::.DataPager

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)
Visual Basic
<ThemeableAttribute(True)> _
<ToolboxBitmapAttribute(GetType(DataPager), "DataPager.bmp")> _
Public Class DataPager _
    Inherits Control _
    Implements IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
C#
[ThemeableAttribute(true)]
[ToolboxBitmapAttribute(typeof(DataPager), "DataPager.bmp")]
public class DataPager : Control, IAttributeAccessor, 
    INamingContainer, ICompositeControlDesignerAccessor
Visual C++
[ThemeableAttribute(true)]
[ToolboxBitmapAttribute(typeof(DataPager), L"DataPager.bmp")]
public ref class DataPager : public Control, 
    IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
F#
[<ThemeableAttribute(true)>]
[<ToolboxBitmapAttribute(typeof(DataPager), "DataPager.bmp")>]
type DataPager =  
    class
        inherit Control
        interface IAttributeAccessor
        interface INamingContainer
        interface ICompositeControlDesignerAccessor
    end
ASP.NET
<asp:DataPager />

The DataPager type exposes the following members.

  NameDescription
Public methodDataPagerInitializes a new instance of the DataPager class.
Top
  NameDescription
Protected propertyAdapterGets the browser-specific adapter for the control. (Inherited from Control.)
Public propertyAppRelativeTemplateSourceDirectoryGets or sets the application-relative virtual directory of the Page or UserControl object that contains this control. (Inherited from Control.)
Public propertyAttributesGets a collection of custom attribute name/value pairs for the DataPager control.
Public propertyBindingContainerInfrastructure. Gets the control that contains this control's data binding. (Inherited from Control.)
Protected propertyChildControlsCreatedGets a value that indicates whether the server control's child controls have been created. (Inherited from Control.)
Public propertyClientIDGets the control ID for HTML markup that is generated by ASP.NET. (Inherited from Control.)
Public propertyClientIDModeGets or sets the algorithm that is used to generate the value of the ClientID property. (Inherited from Control.)
Protected propertyClientIDSeparatorGets a character value representing the separator character used in the ClientID property. (Inherited from Control.)
Protected propertyContextGets the HttpContext object associated with the server control for the current Web request. (Inherited from Control.)
Public propertyControlsGets a ControlCollection object that represents the child controls for the DataPager control in the UI hierarchy. (Overrides Control..::.Controls.)
Public propertyDataItemContainerGets a reference to the naming container if the naming container implements IDataItemContainer. (Inherited from Control.)
Public propertyDataKeysContainerGets a reference to the naming container if the naming container implements IDataKeysControl. (Inherited from Control.)
Protected propertyDesignModeGets a value indicating whether a control is being used on a design surface. (Inherited from Control.)
Public propertyEnableThemingGets or sets a value indicating whether themes apply to this control. (Inherited from Control.)
Public propertyEnableViewStateGets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client. (Inherited from Control.)
Protected propertyEventsGets a list of event handler delegates for the control. This property is read-only. (Inherited from Control.)
Public propertyFieldsGets a collection of DataPagerField objects that represent the pager fields that are specified in a DataPager control.
Protected propertyHasChildViewStateGets a value indicating whether the current server control's child controls have any saved view-state settings. (Inherited from Control.)
Public propertyIDGets or sets the programmatic identifier assigned to the server control. (Inherited from Control.)
Protected propertyIdSeparatorInfrastructure. Gets the character used to separate control identifiers. (Inherited from Control.)
Protected propertyIsChildControlStateClearedGets a value indicating whether controls contained within this control have control state. (Inherited from Control.)
Protected propertyIsTrackingViewStateGets a value that indicates whether the server control is saving changes to its view state. (Inherited from Control.)
Protected propertyIsViewStateEnabledGets a value indicating whether view state is enabled for this control. (Inherited from Control.)
Protected propertyLoadViewStateByIDGets a value indicating whether the control participates in loading its view state by ID instead of index. (Inherited from Control.)
Public propertyMaximumRowsGets the maximum number of records that are displayed for each page of data.
Public propertyNamingContainerGets a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same Control..::.ID property value. (Inherited from Control.)
Public propertyPageGets a reference to the Page instance that contains the server control. (Inherited from Control.)
Public propertyPagedControlIDGets or sets the ID of the control that contains the data that will be paged by the DataPager control.
Public propertyPageSizeGets or sets the number of records that are displayed for each page of data.
Public propertyParentGets a reference to the server control's parent control in the page control hierarchy. (Inherited from Control.)
Public propertyQueryStringFieldGets or sets the name of the query string field.
Public propertyRenderingCompatibilityGets a value that specifies the ASP.NET version that rendered HTML will be compatible with. (Inherited from Control.)
Public propertySiteGets information about the container that hosts the current control when rendered on a design surface. (Inherited from Control.)
Public propertySkinIDGets or sets the skin to apply to the control. (Inherited from Control.)
Public propertyStartRowIndexGets the index of the first record that is displayed on a page of data .
Protected propertyTagKeyGets the HTML element that is used to render the DataPager control.
Public propertyTemplateControlGets or sets a reference to the template that contains this control. (Inherited from Control.)
Public propertyTemplateSourceDirectoryGets the virtual directory of the Page or UserControl that contains the current server control. (Inherited from Control.)
Public propertyTotalRowCountGets the total number of records that are retrieved by the underlying data source object that is referenced by the associated data-bound control.
Public propertyUniqueIDGets the unique, hierarchically qualified identifier for the server control. (Inherited from Control.)
Protected propertyViewStateGets a dictionary of state information that allows you to save and restore the view state of a server control across multiple requests for the same page. (Inherited from Control.)
Protected propertyViewStateIgnoresCaseGets a value that indicates whether the StateBag object is case-insensitive. (Inherited from Control.)
Public propertyViewStateModeGets or sets the view-state mode of this control. (Inherited from Control.)
Public propertyVisibleGets or sets a value that indicates whether a server control is rendered as UI on the page. (Inherited from Control.)
Top
  NameDescription
Protected methodAddAttributesToRenderAdds HTML attributes and styles to be rendered in the browser to the specified HtmlTextWriter object.
Protected methodAddedControlCalled after a child control is added to the Controls collection of the Control object. (Inherited from Control.)
Protected methodAddParsedSubObjectNotifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object. (Inherited from Control.)
Public methodApplyStyleSheetSkinApplies the style properties defined in the page style sheet to the control. (Inherited from Control.)
Protected methodBuildProfileTreeInfrastructure. Gathers information about the server control and delivers it to the Trace property to be displayed when tracing is enabled for the page. (Inherited from Control.)
Protected methodClearCachedClientIDInfrastructure. Sets the cached ClientID value to nullNothingnullptra null reference (Nothing in Visual Basic). (Inherited from Control.)
Protected methodClearChildControlStateDeletes the control-state information for the server control's child controls. (Inherited from Control.)
Protected methodClearChildStateDeletes the view-state and control-state information for all the server control's child controls. (Inherited from Control.)
Protected methodClearChildViewStateDeletes the view-state information for all the server control's child controls. (Inherited from Control.)
Protected methodClearEffectiveClientIDModeInfrastructure. Sets the ClientIDMode property of the current control instance and of any child controls to Inherit. (Inherited from Control.)
Protected methodConnectToEventsConnects events to event handler methods in the DataPager control.
Protected methodCreateChildControlsCalled by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering. (Inherited from Control.)
Protected methodCreateControlCollectionCreates a new ControlCollection object to hold the child controls (both literal and server) of the server control. (Inherited from Control.)
Protected methodCreatePagerFieldsCreates the DataPagerField objects that are contained by the Fields property of the DataPager control.
Public methodDataBind()()()Binds the DataPager control and all its child controls to a data source. (Overrides Control..::.DataBind()()().)
Protected methodDataBind(Boolean)Binds a data source to the invoked server control and all its child controls with an option to raise the DataBinding event. (Inherited from Control.)
Protected methodDataBindChildrenBinds a data source to the server control's child controls. (Inherited from Control.)
Public methodDisposeEnables a server control to perform final clean up before it is released from memory. (Inherited from Control.)
Protected methodEnsureChildControlsDetermines whether the server control contains child controls. If it does not, it creates child controls. (Inherited from Control.)
Protected methodEnsureIDCreates an identifier for controls that do not have an identifier assigned. (Inherited from Control.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFindControl(String)Searches the current naming container for a server control with the specified id parameter. (Inherited from Control.)
Protected methodFindControl(String, Int32)Infrastructure. Searches the current naming container for a server control with the specified id and an integer, specified in the pathOffset parameter, which aids in the search. You should not override this version of the FindControl method. (Inherited from Control.)
Protected methodFindPageableItemContainerRetrieves the data-bound control that is associated with the DataPager control.
Public methodFocusSets input focus to a control. (Inherited from Control.)
Protected methodGetDesignModeStateInfrastructure. Gets design-time data for a control. (Inherited from Control.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetRouteUrl(Object)Gets the URL that corresponds to a set of route parameters. (Inherited from Control.)
Public methodGetRouteUrl(RouteValueDictionary)Gets the URL that corresponds to a set of route parameters. (Inherited from Control.)
Public methodGetRouteUrl(String, Object)Gets the URL that corresponds to a set of route parameters and a route name. (Inherited from Control.)
Public methodGetRouteUrl(String, RouteValueDictionary)Gets the URL that corresponds to a set of route parameters and a route name. (Inherited from Control.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetUniqueIDRelativeToReturns the prefixed portion of the UniqueID property of the specified control. (Inherited from Control.)
Public methodHasControlsDetermines if the server control contains any child controls. (Inherited from Control.)
Protected methodHasEventsReturns a value indicating whether events are registered for the control or any child controls. (Inherited from Control.)
Protected methodIsLiteralContentInfrastructure. Determines if the server control holds only literal content. (Inherited from Control.)
Protected methodLoadControlStateInfrastructure. Loads the state information for the properties in the DataPager control that must be persisted between postbacks, even when the EnableViewState property is set to false. (Overrides Control..::.LoadControlState(Object).)
Protected methodLoadViewStateRestores view-state information for the DataPager control that was saved by the SaveViewState method during a previous page request. (Overrides Control..::.LoadViewState(Object).)
Protected methodMapPathSecureRetrieves the physical path that a virtual path, either absolute or relative, maps to. (Inherited from Control.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnBubbleEventDetermines whether an event for the DataPager control is passed up the page's user interface (UI) server control hierarchy (Overrides Control..::.OnBubbleEvent(Object, EventArgs).)
Protected methodOnDataBindingRaises the DataBinding event. (Inherited from Control.)
Protected methodOnInitInfrastructure. Raises the Init event. (Overrides Control..::.OnInit(EventArgs).)
Protected methodOnLoadInfrastructure. Raises the Load event. (Overrides Control..::.OnLoad(EventArgs).)
Protected methodOnPreRenderRaises the PreRender event. (Inherited from Control.)
Protected methodOnTotalRowCountAvailableHandles the IPageableItemContainer..::.TotalRowCountAvailable event.
Protected methodOnUnloadRaises the Unload event. (Inherited from Control.)
Protected methodOpenFileGets a Stream used to read a file. (Inherited from Control.)
Protected methodRaiseBubbleEventAssigns any sources of the event and its information to the control's parent. (Inherited from Control.)
Protected methodRecreateChildControlsCreates child controls of the DataPager control at design time.
Protected methodRemovedControlCalled after a child control is removed from the Controls collection of the Control object. (Inherited from Control.)
Protected methodRenderInfrastructure. Sends the DataPager control content to the specified HtmlTextWriter object, which writes the content to be rendered to the browser. (Overrides Control..::.Render(HtmlTextWriter).)
Public methodRenderBeginTagRenders the HTML opening tag of the DataPager control to the specified writer.
Protected methodRenderChildrenOutputs the content of a server control's children to a provided HtmlTextWriter object, which writes the content to be rendered on the client. (Inherited from Control.)
Protected methodRenderContentsRenders the contents of the DataPager control to the specified writer.
Public methodRenderControl(HtmlTextWriter)Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled. (Inherited from Control.)
Protected methodRenderControl(HtmlTextWriter, ControlAdapter)Outputs server control content to a provided HtmlTextWriter object using a provided ControlAdapter object. (Inherited from Control.)
Protected methodResolveAdapterGets the control adapter responsible for rendering the specified control. (Inherited from Control.)
Public methodResolveClientUrlGets a URL that can be used by the browser. (Inherited from Control.)
Public methodResolveUrlConverts a URL into one that is usable on the requesting client. (Inherited from Control.)
Protected methodSaveControlStateInfrastructure. Saves the state of the properties in the DataPager control that must be persisted between postbacks, even when the EnableViewState property is set to false. (Overrides Control..::.SaveControlState()()().)
Protected methodSaveViewStateSaves any changes to an DataPager control's view-state that have occurred since the time the page was posted back to the server. (Overrides Control..::.SaveViewState()()().)
Protected methodSetDesignModeStateSets design-time data for a control. (Inherited from Control.)
Public methodSetPagePropertiesSets the page-related properties in the DataPager control.
Public methodSetRenderMethodDelegateInfrastructure. Assigns an event handler delegate to render the server control and its content into its parent control. (Inherited from Control.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Protected methodTrackViewStateTracks view-state changes to the DataPager control so that they can be stored in the control's StateBag object. This object can be accessed through the ViewState property. (Overrides Control..::.TrackViewState()()().)
Top
  NameDescription
Public eventDataBindingOccurs when the server control binds to a data source. (Inherited from Control.)
Public eventDisposedOccurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested. (Inherited from Control.)
Public eventInitOccurs when the server control is initialized, which is the first step in its lifecycle. (Inherited from Control.)
Public eventLoadOccurs when the server control is loaded into the Page object. (Inherited from Control.)
Public eventPreRenderOccurs after the Control object is loaded but prior to rendering. (Inherited from Control.)
Public eventUnloadOccurs when the server control is unloaded from memory. (Inherited from Control.)
Top
  NameDescription
Public Extension MethodEnableDynamicData(Type)Overloaded. Enables Dynamic Data behavior for the specified data control. (Defined by DataControlExtensions.)
Public Extension MethodEnableDynamicData(Type, Object)Overloaded. Enables Dynamic Data behavior for the specified data control. (Defined by DataControlExtensions.)
Public Extension MethodEnableDynamicData(Type, IDictionary<(Of <(String, Object>)>))Overloaded. Enables Dynamic Data behavior for the specified data control. (Defined by DataControlExtensions.)
Public Extension MethodFindDataSourceControlReturns the data source that is associated with the data control for the specified control. (Defined by DynamicDataExtensions.)
Public Extension MethodFindFieldTemplateReturns the field template for the specified column in the specified control's naming container. (Defined by DynamicDataExtensions.)
Public Extension MethodFindMetaTableReturns the metatable object for the containing data control. (Defined by DynamicDataExtensions.)
Public Extension MethodGetDefaultValuesGets the collection of the default values for the specified data control. (Defined by DynamicDataExtensions.)
Public Extension MethodGetMetaTableGets the table metadata for the specified data control. (Defined by DynamicDataExtensions.)
Public Extension MethodSetMetaTable(MetaTable)Overloaded. Sets the table metadata for the specified data control. (Defined by DynamicDataExtensions.)
Public Extension MethodSetMetaTable(MetaTable, IDictionary<(Of <(String, Object>)>))Overloaded. Sets the table metadata and default value mapping for the specified data control. (Defined by DynamicDataExtensions.)
Public Extension MethodSetMetaTable(MetaTable, Object)Overloaded. Sets the table metadata and default value mapping for the specified data control. (Defined by DynamicDataExtensions.)
Public Extension MethodTryGetMetaTableDetermines whether table metadata is available. (Defined by DynamicDataExtensions.)
Top
  NameDescription
Explicit interface implemetationPrivate methodIAttributeAccessor..::.GetAttributeInfrastructure. Retrieves the attribute value with the specified name from the DataPager control.
Explicit interface implemetationPrivate methodIAttributeAccessor..::.SetAttributeInfrastructure. Sets an attribute of the DataPager control with the specified name and value.
Explicit interface implemetationPrivate methodICompositeControlDesignerAccessor..::.RecreateChildControlsInfrastructure. Creates the child controls of the DataPager control at design time.
Explicit interface implemetationPrivate propertyIControlBuilderAccessor..::.ControlBuilderFor a description of this member, see IControlBuilderAccessor..::.ControlBuilder. (Inherited from Control.)
Explicit interface implemetationPrivate methodIControlDesignerAccessor..::.GetDesignModeStateFor a description of this member, see IControlDesignerAccessor..::.GetDesignModeState. (Inherited from Control.)
Explicit interface implemetationPrivate methodIControlDesignerAccessor..::.SetDesignModeStateFor a description of this member, see IControlDesignerAccessor..::.SetDesignModeState. (Inherited from Control.)
Explicit interface implemetationPrivate methodIControlDesignerAccessor..::.SetOwnerControlInfrastructure. For a description of this member, see IControlDesignerAccessor..::.SetOwnerControl. (Inherited from Control.)
Explicit interface implemetationPrivate propertyIControlDesignerAccessor..::.UserDataFor a description of this member, see IControlDesignerAccessor..::.UserData. (Inherited from Control.)
Explicit interface implemetationPrivate propertyIDataBindingsAccessor..::.DataBindingsFor a description of this member, see IDataBindingsAccessor..::.DataBindings. (Inherited from Control.)
Explicit interface implemetationPrivate propertyIDataBindingsAccessor..::.HasDataBindingsFor a description of this member, see IDataBindingsAccessor..::.HasDataBindings. (Inherited from Control.)
Explicit interface implemetationPrivate propertyIExpressionsAccessor..::.ExpressionsFor a description of this member, see IExpressionsAccessor..::.Expressions. (Inherited from Control.)
Explicit interface implemetationPrivate propertyIExpressionsAccessor..::.HasExpressionsFor a description of this member, see IExpressionsAccessor..::.HasExpressions. (Inherited from Control.)
Explicit interface implemetationPrivate methodIParserAccessor..::.AddParsedSubObjectFor a description of this member, see IParserAccessor..::.AddParsedSubObject. (Inherited from Control.)
Top

In this topic:

Introduction

The DataPager class is used to page data and to display navigation controls for data-bound controls that implement the IPageableItemContainer interface. (An example of a control that implements the interface is the ListView control.)

You can associate the DataPager control with the data-bound control by using the PagedControlID property. Alternatively, you can put the DataPager control inside the data-bound control hierarchy. For example, in the ListView control, you can put the DataPager control inside the ListView..::.LayoutTemplate template.

You can customize the number of items that are displayed for each page of data by changing the PageSize property. You can also change the way a page is submitted to the server by setting the QueryStringField property.

Pager Fields

In order for the DataPager control to display navigation controls, you must add pager fields to the control. The pager fields derive from the DataPagerField class. The following table lists the pager field types that you can use.

Pager field type

Description

NextPreviousPagerField

Enables users to navigate through pages one page at a time, or to jump to the first or last page.

NumericPagerField

Enables users to select a page by page number.

TemplatePagerField

Enables you to create a custom paging UI.

To declaratively add pager fields to the DataPager control, add a Fields element to the DataPager control. You can then add the pager fields to the Fields element. The pager fields are added to the Fields collection in the order that they appear in the Fields element. The Fields collection enables you to programmatically manage the pager fields in the DataPager control.

Page Properties

The following table lists read-only properties of the DataPager control that specify characteristics of the page of data. These properties are usually used for binding expressions in the TemplatePagerField object.

Property

Description

MaximumRows

The maximum number of records that are displayed for each page of data.

StartRowIndex

The index of the first record that is displayed on a page of data.

TotalRowCount

The total number of records that are available in the underlying data source.

Accessibility

The default markup that is rendered default for this control might not comply with accessibility standards, such as the Web Content Accessibility Guidelines 1.0 (WCAG) priority 1 guidelines. For details about accessibility support for this control, see ASP.NET Controls and Accessibility.

Declarative Syntax

<asp:DataPager
    EnableTheming="True|False"
    EnableViewState="True|False"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    PagedControlID="string"
    PageSize="integer"
    runat="server"
    SkinID="string"
    Visible="True|False"
>
        <Fields>
            <asp:NextPreviousPagerField
                ButtonCssClass="string"
                ButtonType="Button|Image|Link"
                FirstPageImageUrl="string"
                FirstPageText="string"
                LastPageImageUrl="string"
                LastPageText="string"
                NextPageImageUrl="string"
                NextPageText="string"
                PreviousPageImageUrl="string"
                PreviousPageText="string"
                RenderDisabledButtonsAsLabels="True|False"
                RenderNonBreakingSpacesBetweenControls="True|False"
                ShowFirstPageButton="True|False"
                ShowLastPageButton="True|False"
                ShowNextPageButton="True|False"
                ShowPreviousPageButton="True|False"
                Visible="True|False"
            />
            <asp:NumericPagerField
                ButtonCount="integer"
                ButtonType="Button|Image|Link"
                CurrentPageLabelCssClass="string"
                NextPageImageUrl="string"
                NextPageText="string"
                NextPreviousButtonCssClass="string"
                NumericButtonCssClass="string"                 PreviousPageImageUrl="string"
                PreviousPageText="string"
                RenderNonBreakingSpacesBetweenControls="True|False"
                Visible="True|False"
            />
            <asp:TemplatePagerField
                OnPagerCommand="PagerCommand event handler"
                Visible="True|False"
            />
        </Fields>
</asp:DataPager>

The following example shows how to add paging functionality to a ListView control. This example contains two DataPager controls that are used to page through data of the same ListView control.

Visual Basic
<%@ Page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html  >
  <head id="Head1" runat="server">
    <title>DataPager Example</title>
    <style type="text/css">        
      th
      {
        background-color:#eef4fa;
        border-top:solid 1px #9dbbcc;
        border-bottom:solid 1px #9dbbcc;
      }
      .itemSeparator { border-right: 1px solid #ccc }
      .groupSeparator
      {
        height: 1px;
        background-color: #cccccc;
      }
    </style>
</head>
<body>
    <form id="form1" runat="server">

      <h3>DataPager Example</h3>

      <!-- The first DataPager control. -->
      <asp:DataPager runat="server" ID="BeforeListDataPager"
        PagedControlID="ProductsListView" 
        PageSize="18">
        <Fields>
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            FirstPageImageUrl="~/images/first.gif" />
          <asp:NumericPagerField ButtonCount="10" />
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            LastPageImageUrl="~/images/last.gif" />
        </Fields>
      </asp:DataPager>

      <asp:ListView ID="ProductsListView" 
        DataSourceID="ProductsDataSource" 
        GroupItemCount="3"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" id="tbl1" runat="server">
            <tr>
              <th colspan="5">PRODUCTS LIST</th>
            </tr>
            <tr runat="server" id="groupPlaceholder"></tr>
          </table>
        </LayoutTemplate>
        <GroupTemplate>
          <tr runat="server" id="tr1">
            <td runat="server" id="itemPlaceholder"></td>
          </tr>
        </GroupTemplate>
        <GroupSeparatorTemplate>
          <tr runat="server">
            <td colspan="5">
                <div class="groupSeparator"><hr></div>
              </td>
          </tr>
        </GroupSeparatorTemplate>
        <ItemTemplate>
          <td align="center" runat="server">
            <asp:HyperLink ID="ProductLink" runat="server" 
              Text='<%# Eval("Name") %>' 
              NavigateUrl='<%# "ProductDetails.aspx?productID=" & Eval("ProductID") %>' /><br />
            <asp:Image ID="ProductImage" runat="server"
              ImageUrl='<%#"~/images/thumbnails/" & Eval("ThumbnailPhotoFileName") %>' /><br />
            <b>Price:</b> <%# Eval("ListPrice", "{0:c}")%> <br />
          </td>
        </ItemTemplate>
        <ItemSeparatorTemplate>
          <td class="itemSeparator" runat="server">&nbsp;</td>
        </ItemSeparatorTemplate>
      </asp:ListView>

      <!-- The second DataPager control. -->
      <asp:DataPager runat="server" ID="AfterListDataPager"
        PagedControlID="ProductsListView" 
        PageSize="18">
        <Fields>
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            FirstPageImageUrl="~/images/first.gif" />
          <asp:NumericPagerField ButtonCount="10" />
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            LastPageImageUrl="~/images/last.gif" />
        </Fields>
      </asp:DataPager>

      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->
      <asp:SqlDataSource ID="ProductsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"                        
        SelectCommand="SELECT P.ProductID, P.Name, P.Color, P.ListPrice, 
          PF.ThumbnailPhotoFileName
          FROM Production.Product AS P 
          INNER JOIN Production.ProductProductPhoto AS PPF ON P.ProductID = PPF.ProductID 
          INNER JOIN Production.ProductPhoto AS PF ON PPF.ProductPhotoID = PF.ProductPhotoID">
      </asp:SqlDataSource>

    </form>
  </body>
</html>
C#
<%@ Page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html  >
  <head id="Head1" runat="server">
    <title>DataPager Example</title>
    <style type="text/css">        
      th
      {
        background-color:#eef4fa;
        border-top:solid 1px #9dbbcc;
        border-bottom:solid 1px #9dbbcc;
      }
      .itemSeparator { border-right: 1px solid #ccc }
      .groupSeparator
      {
        height: 1px;
        background-color: #cccccc;
      }
    </style>
</head>
<body>
    <form id="form1" runat="server">

      <h3>DataPager Example</h3>

      <!-- The first DataPager control. -->
      <asp:DataPager runat="server" ID="BeforeListDataPager"
        PagedControlID="ProductsListView" 
        PageSize="18">
        <Fields>
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            FirstPageImageUrl="~/images/first.gif" />
          <asp:NumericPagerField ButtonCount="10" />
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            LastPageImageUrl="~/images/last.gif" />
        </Fields>
      </asp:DataPager>

      <asp:ListView ID="ProductsListView" 
        DataSourceID="ProductsDataSource" 
        GroupItemCount="3"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" id="tbl1" runat="server">
            <tr>
              <th colspan="5">PRODUCTS LIST</th>
            </tr>
            <tr runat="server" id="groupPlaceholder"></tr>
          </table>
        </LayoutTemplate>
        <GroupTemplate>
          <tr runat="server" id="tr1">
            <td runat="server" id="itemPlaceholder"></td>
          </tr>
        </GroupTemplate>
        <GroupSeparatorTemplate>
          <tr runat="server">
            <td colspan="5">
                <div class="groupSeparator"><hr></div>
              </td>
          </tr>
        </GroupSeparatorTemplate>
        <ItemTemplate>
          <td align="center" runat="server">
            <asp:HyperLink ID="ProductLink" runat="server" 
              Text='<%# Eval("Name") %>' 
              NavigateUrl='<%# "ProductDetails.aspx?productID=" + Eval("ProductID") %>' /><br />
            <asp:Image ID="ProductImage" runat="server"
              ImageUrl='<%#"~/images/thumbnails/" + Eval("ThumbnailPhotoFileName") %>' /><br />
            <b>Price:</b> <%# Eval("ListPrice", "{0:c}")%> <br />
          </td>
        </ItemTemplate>
        <ItemSeparatorTemplate>
          <td class="itemSeparator" runat="server">&nbsp;</td>
        </ItemSeparatorTemplate>
      </asp:ListView>

      <!-- The second DataPager control. -->
      <asp:DataPager runat="server" ID="AfterListDataPager"
        PagedControlID="ProductsListView" 
        PageSize="18">
        <Fields>
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            FirstPageImageUrl="~/images/first.gif" />
          <asp:NumericPagerField ButtonCount="10" />
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            LastPageImageUrl="~/images/last.gif" />
        </Fields>
      </asp:DataPager>

      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->
      <asp:SqlDataSource ID="ProductsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"                        
        SelectCommand="SELECT P.ProductID, P.Name, P.Color, P.ListPrice, 
          PF.ThumbnailPhotoFileName
          FROM Production.Product AS P 
          INNER JOIN Production.ProductProductPhoto AS PPF ON P.ProductID = PPF.ProductID 
          INNER JOIN Production.ProductPhoto AS PF ON PPF.ProductPhotoID = PF.ProductPhotoID">
      </asp:SqlDataSource>

    </form>
  </body>
</html>

.NET Framework

Supported in: 4, 3.5

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Riferimento a .NET Framework
Classe DataPager

Fornisce la funzionalità di paging per i controlli con associazione a dati che implementano l'interfaccia IPageableItemContainer, ad esempio il controllo ListView.

System..::.Object
  System.Web.UI..::.Control
    System.Web.UI.WebControls..::.DataPager

Spazio dei nomi:  System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)
Visual Basic
<ThemeableAttribute(True)> _
<ToolboxBitmapAttribute(GetType(DataPager), "DataPager.bmp")> _
Public Class DataPager _
    Inherits Control _
    Implements IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
C#
[ThemeableAttribute(true)]
[ToolboxBitmapAttribute(typeof(DataPager), "DataPager.bmp")]
public class DataPager : Control, IAttributeAccessor, 
    INamingContainer, ICompositeControlDesignerAccessor
Visual C++
[ThemeableAttribute(true)]
[ToolboxBitmapAttribute(typeof(DataPager), L"DataPager.bmp")]
public ref class DataPager : public Control, 
    IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
F#
[<ThemeableAttribute(true)>]
[<ToolboxBitmapAttribute(typeof(DataPager), "DataPager.bmp")>]
type DataPager =  
    class
        inherit Control
        interface IAttributeAccessor
        interface INamingContainer
        interface ICompositeControlDesignerAccessor
    end
ASP.NET
<asp:DataPager />

Il tipo DataPager espone i seguenti membri.

  NomeDescrizione
Metodo pubblicoDataPagerInizializza una nuova istanza della classe DataPager.
In alto
  NomeDescrizione
Proprietà protetta.AdapterOttiene l'adattatore specifico del browser per il controllo. (Ereditato da Control)
Proprietà pubblicaAppRelativeTemplateSourceDirectoryOttiene o imposta la directory virtuale relativa all'applicazione dell'oggetto Page o UserControl contenente questo controllo. (Ereditato da Control)
Proprietà pubblicaAttributesOttiene un insieme di coppie nome/valore dell'attributo personalizzato per il controllo DataPager.
Proprietà pubblicaBindingContainerInfrastruttura. Ottiene il controllo contenente l'associazione dati del controllo corrente. (Ereditato da Control)
Proprietà protetta.ChildControlsCreatedOttiene un valore che indica se i controlli figli del controllo server sono stati creati. (Ereditato da Control)
Proprietà pubblicaClientIDOttiene l'ID controllo per il markup HTML generato da ASP.NET. (Ereditato da Control)
Proprietà pubblicaClientIDModeOttiene o imposta l'algoritmo utilizzato per generare il valore della proprietà ClientID. (Ereditato da Control)
Proprietà protetta.ClientIDSeparatorOttiene un carattere che rappresenta il separatore utilizzato nella proprietà ClientID. (Ereditato da Control)
Proprietà protetta.ContextOttiene l'oggetto HttpContext associato al controllo server per la richiesta Web corrente. (Ereditato da Control)
Proprietà pubblicaControlsOttiene un oggetto ControlCollection che rappresenta i controlli figlio per il controllo DataPager specificato nella gerarchia di interfacce utente. (Esegue l'override di Control..::.Controls).
Proprietà pubblicaDataItemContainerOttiene un riferimento al contenitore di denominazione se il contenitore di denominazione implementa IDataItemContainer. (Ereditato da Control)
Proprietà pubblicaDataKeysContainerOttiene un riferimento al contenitore di denominazione se il contenitore di denominazione implementa IDataKeysControl. (Ereditato da Control)
Proprietà protetta.DesignModeOttiene un valore che indica se un controllo viene utilizzato in un'area di progettazione. (Ereditato da Control)
Proprietà pubblicaEnableThemingOttiene o imposta un valore che indica se al controllo vengono applicati i temi. (Ereditato da Control)
Proprietà pubblicaEnableViewStateOttiene o imposta un valore che indica se il controllo server conserva il proprio stato di visualizzazione e lo stato di visualizzazione dei controlli figlio in esso contenuti per il client richiedente. (Ereditato da Control)
Proprietà protetta.EventsOttiene un elenco dei delegati del gestore eventi per il controllo. Questa proprietà è in sola lettura. (Ereditato da Control)
Proprietà pubblicaFieldsOttiene un insieme di oggetti DataPagerField che rappresentano i campi del pager specificati in un controllo DataPager.
Proprietà protetta.HasChildViewStateOttiene un valore che indica se per i controlli figlio del controllo server corrente esistono impostazioni dello stato di visualizzazione salvate. (Ereditato da Control)
Proprietà pubblicaIDOttiene o imposta l'identificatore a livello di codice assegnato al controllo server. (Ereditato da Control)
Proprietà protetta.IdSeparatorInfrastruttura. Ottiene il carattere utilizzato per separare gli identificatori di controllo. (Ereditato da Control)
Proprietà protetta.IsChildControlStateClearedOttiene un valore che indica se i controlli contenuti in questo controllo dispongono di informazioni sullo stato del controllo. (Ereditato da Control)
Proprietà protetta.IsTrackingViewStateOttiene un valore che indica se il controllo server salva le modifiche allo stato di visualizzazione. (Ereditato da Control)
Proprietà protetta.IsViewStateEnabledOttiene un valore che indica se lo stato di visualizzazione è attivato per il controllo corrente. (Ereditato da Control)
Proprietà protetta.LoadViewStateByIDOttiene un valore che indica se il controllo prende parte al caricamento del proprio stato di visualizzazione tramite ID anziché tramite l'indice. (Ereditato da Control)
Proprietà pubblicaMaximumRowsOttiene il numero massimo di record visualizzati per ogni pagina di dati.
Proprietà pubblicaNamingContainerOttiene un riferimento al contenitore dei nomi del controllo server, che crea uno spazio dei nomi univoco per distinguere i controlli server che hanno lo stesso valore della proprietà Control..::.ID. (Ereditato da Control)
Proprietà pubblicaPageOttiene un riferimento all'istanza Page che contiene il controllo server. (Ereditato da Control)
Proprietà pubblicaPagedControlIDOttiene o imposta la proprietà ID del controllo contenente i dati di cui il controllo DataPager eseguirà il paging.
Proprietà pubblicaPageSizeOttiene o imposta il numero di record visualizzati per ogni pagina di dati.
Proprietà pubblicaParentOttiene un riferimento al controllo padre del controllo server nella gerarchia dei controlli della pagina. (Ereditato da Control)
Proprietà pubblicaQueryStringFieldOttiene o imposta il nome del campo della stringa di query.
Proprietà pubblicaRenderingCompatibilityOttiene un valore che specifica la versione di ASP.NET con cui sarà compatibile il codice HTML di cui è stato eseguito il rendering. (Ereditato da Control)
Proprietà pubblicaSiteOttiene informazioni sul contenitore del controllo corrente quando viene eseguito il rendering in un'area di progettazione. (Ereditato da Control)
Proprietà pubblicaSkinIDOttiene o imposta l'interfaccia da applicare al controllo. (Ereditato da Control)
Proprietà pubblicaStartRowIndexOttiene l'indice del primo record visualizzato in una pagina di dati.
Proprietà protetta.TagKeyOttiene l'elemento HTML utilizzato per il rendering del controllo DataPager.
Proprietà pubblicaTemplateControlOttiene o imposta un riferimento al modello che contiene il controllo. (Ereditato da Control)
Proprietà pubblicaTemplateSourceDirectoryOttiene la directory virtuale dell'oggetto Page o dell'oggetto UserControl che contiene il controllo server corrente. (Ereditato da Control)
Proprietà pubblicaTotalRowCountOttiene il numero totale di record recuperati dall'oggetto origine dati sottostante a cui fa riferimento il controllo con associazione a dati associato.
Proprietà pubblicaUniqueIDOttiene l'identificatore univoco qualificato gerarchicamente per il controllo server. (Ereditato da Control)
Proprietà protetta.ViewStateOttiene un dizionario di informazioni sullo stato che permette di salvare e ripristinare lo stato di visualizzazione di un controllo server attraverso più richieste per la stessa pagina. (Ereditato da Control)
Proprietà protetta.ViewStateIgnoresCaseOttiene un valore che indica se l'oggetto StateBag non effettua la distinzione tra maiuscole e minuscole. (Ereditato da Control)
Proprietà pubblicaViewStateModeOttiene o imposta la modalità dello stato, visualizzazione di questo controllo. (Ereditato da Control)
Proprietà pubblicaVisibleOttiene o imposta un valore che indica se un controllo server viene visualizzato come interfaccia utente sulla pagina. (Ereditato da Control)
In alto
  NomeDescrizione
Metodo protettoAddAttributesToRenderAggiunge stili e attributi HTML dei quali è necessario eseguire il rendering nel browser nell'oggetto HtmlTextWriter specificato.
Metodo protettoAddedControlViene chiamato dopo che un controllo è stato aggiunto all'insieme Controls dell'oggetto Control. (Ereditato da Control)
Metodo protettoAddParsedSubObjectNotifica al controllo server che un elemento, XML o HTML, è stato analizzato e aggiunge l'elemento all'oggetto ControlCollection del controllo server. (Ereditato da Control)
Metodo pubblicoApplyStyleSheetSkinApplica al controllo le proprietà di stile definite nel foglio di stile della pagina. (Ereditato da Control)
Metodo protettoBuildProfileTreeInfrastruttura. Raccoglie informazioni sul controllo server e le recapita alla proprietà Trace in modo che vengano visualizzate quando è attivata la tracciatura per la pagina. (Ereditato da Control)
Metodo protettoClearCachedClientIDInfrastruttura. Imposta il valore memorizzato nella cache ClientID su nullNothingnullptrriferimento null (Nothing in Visual Basic). (Ereditato da Control)
Metodo protettoClearChildControlStateElimina le informazioni sullo stato del controllo per i controlli figlio del controllo server. (Ereditato da Control)
Metodo protettoClearChildStateElimina le informazioni sullo stato di visualizzazione e sullo stato del controllo per tutti i controlli figlio del controllo server. (Ereditato da Control)
Metodo protettoClearChildViewStateElimina le informazioni sullo stato di visualizzazione per tutti i controlli figlio del controllo server. (Ereditato da Control)
Metodo protettoClearEffectiveClientIDModeInfrastruttura. Imposta la proprietà ClientIDMode dell'istanza del controllo corrente e di tutti i controlli figlio su Inherit. (Ereditato da Control)
Metodo protettoConnectToEventsConnette eventi a metodi del gestore eventi nel controllo DataPager.
Metodo protettoCreateChildControlsViene chiamato dal framework della pagina ASP.NET per notificare ai controlli server che utilizzano un'implementazione basata sulla composizione di creare gli eventuali controlli figlio in essi contenuti per la preparazione al postback o al rendering. (Ereditato da Control)
Metodo protettoCreateControlCollectionCrea un nuovo oggetto ControlCollection per contenere i controlli figlio (letterali e server) del controllo server. (Ereditato da Control)
Metodo protettoCreatePagerFieldsCrea gli oggetti DataPagerField contenuti dalla proprietà Fields del controllo DataPager.
Metodo pubblicoDataBind()()()Associa il controllo DataPager e tutti i controlli figlio a un'origine dati. (Esegue l'override di Control..::.DataBind()()()).
Metodo protettoDataBind(Boolean)Associa un'origine dati al controllo server chiamato e ai relativi controlli figlio con un'opzione per generare l'evento DataBinding. (Ereditato da Control)
Metodo protettoDataBindChildrenAssocia un'origine dati al controllo server e ai relativi controlli figlio. (Ereditato da Control)
Metodo pubblicoDisposeAbilita un controllo server alla pulizia finale prima che venga rilasciato dalla memoria. (Ereditato da Control)
Metodo protettoEnsureChildControlsDetermina se il controllo server contiene controlli figlio. In caso contrario, li crea. (Ereditato da Control)
Metodo protettoEnsureIDCrea un identificatore per i controlli a cui non è assegnato alcun identificatore. (Ereditato da Control)
Metodo pubblicoEquals(Object)Determina se l'oggetto Object specificato è uguale all'oggetto Object corrente. (Ereditato da Object)
Metodo protettoFinalizeConsente a un oggetto di provare a liberare risorse ed eseguire altre operazioni di pulitura prima che l'oggetto stesso venga recuperato dalla procedura di Garbage Collection. (Ereditato da Object)
Metodo pubblicoFindControl(String)Cerca un controllo server nel contenitore dei nomi corrente con il parametro id specificato. (Ereditato da Control)
Metodo protettoFindControl(String, Int32)Infrastruttura. Cerca nel contenitore di denominazione corrente un controllo server con il parametro id indicato e un intero, specificato nel parametro pathOffset, che agevola la ricerca. Non eseguire l'override di questa versione del metodo FindControl. (Ereditato da Control)
Metodo protettoFindPageableItemContainerRecupera il controllo con associazione a dati associato al controllo DataPager.
Metodo pubblicoFocusImposta lo stato attivo per l'input su un controllo. (Ereditato da Control)
Metodo protettoGetDesignModeStateInfrastruttura. Ottiene i dati della fase di progettazione per un controllo. (Ereditato da Control)
Metodo pubblicoGetHashCodeFunge da funzione hash per un determinato tipo. (Ereditato da Object)
Metodo pubblicoGetRouteUrl(Object)Ottiene l'URL corrispondente a un set di parametri di route. (Ereditato da Control)
Metodo pubblicoGetRouteUrl(RouteValueDictionary)Ottiene l'URL corrispondente a un set di parametri di route. (Ereditato da Control)
Metodo pubblicoGetRouteUrl(String, Object)Ottiene l'URL che corrisponde a un set di parametri di route e a un nome della route. (Ereditato da Control)
Metodo pubblicoGetRouteUrl(String, RouteValueDictionary)Ottiene l'URL che corrisponde a un set di parametri di route e a un nome della route. (Ereditato da Control)
Metodo pubblicoGetTypeOttiene l'oggetto Type dell'istanza corrente. (Ereditato da Object)
Metodo pubblicoGetUniqueIDRelativeToRestituisce la parte con prefisso della proprietà UniqueID del controllo specificato. (Ereditato da Control)
Metodo pubblicoHasControlsDetermina se il controllo server contiene controlli figlio. (Ereditato da Control)
Metodo protettoHasEventsRestituisce un valore che indica se gli eventi vengono registrati per il controllo o eventuali controlli figlio. (Ereditato da Control)
Metodo protettoIsLiteralContentInfrastruttura. Determina se il controllo server conserva solo il contenuto literal. (Ereditato da Control)
Metodo protettoLoadControlStateInfrastruttura. Carica le informazioni sullo stato delle proprietà nel controllo DataPager che deve essere mantenuto tra un postback e l'altro, anche quando la proprietà EnableViewState è impostata su false. (Esegue l'override di Control..::.LoadControlState(Object)).
Metodo protettoLoadViewStateRipristina le informazioni sullo stato di visualizzazione per il controllo DataPager salvato dal metodo SaveViewState durante una richiesta di pagina precedente. (Esegue l'override di Control..::.LoadViewState(Object)).
Metodo protettoMapPathSecureRecupera il percorso fisico al quale è associato un percorso virtuale, assoluto o relativo. (Ereditato da Control)
Metodo protettoMemberwiseCloneConsente di creare una copia dei riferimenti dell'oggetto Object corrente. (Ereditato da Object)
Metodo protettoOnBubbleEventDetermina se un evento per il controllo DataPager viene passato a un livello superiore nella gerarchia dei controlli server dell'interfaccia utente della pagina. (Esegue l'override di Control..::.OnBubbleEvent(Object, EventArgs)).
Metodo protettoOnDataBindingGenera l'evento DataBinding. (Ereditato da Control)
Metodo protettoOnInitInfrastruttura. Genera l'evento Init. (Esegue l'override di Control..::.OnInit(EventArgs)).
Metodo protettoOnLoadInfrastruttura. Genera l'evento Load. (Esegue l'override di Control..::.OnLoad(EventArgs)).
Metodo protettoOnPreRenderGenera l'evento PreRender. (Ereditato da Control)
Metodo protettoOnTotalRowCountAvailableConsente di gestire l'evento IPageableItemContainer..::.TotalRowCountAvailable.
Metodo protettoOnUnloadGenera l'evento Unload. (Ereditato da Control)
Metodo protettoOpenFileOttiene un oggetto Stream utilizzato per leggere un file. (Ereditato da Control)
Metodo protettoRaiseBubbleEventAssegna eventuali origini dell'evento e relative informazioni al controllo padre. (Ereditato da Control)
Metodo protettoRecreateChildControlsCrea controlli figlio del controllo DataPager in fase di progettazione.
Metodo protettoRemovedControlViene chiamato dopo la rimozione di un controllo figlio dall'insieme Controls dell'oggetto Control. (Ereditato da Control)
Metodo protettoRenderInfrastruttura. Invia il contenuto del controllo DataPager all'oggetto HtmlTextWriter specificato, che scrive il contenuto da sottoporre a rendering nel browser. (Esegue l'override di Control..::.Render(HtmlTextWriter)).
Metodo pubblicoRenderBeginTagEsegue il rendering del tag HTML di apertura del controllo DataPager nel writer specificato.
Metodo protettoRenderChildrenInvia il contenuto di un controllo figlio del controllo server a un oggetto HtmlTextWriter fornito, che scrive il contenuto di cui verrà effettuato il rendering sul client. (Ereditato da Control)
Metodo protettoRenderContentsEsegue il rendering del contenuto del controllo DataPager nel writer specificato.
Metodo pubblicoRenderControl(HtmlTextWriter)Restituisce il contenuto del controllo server a un oggetto HtmlTextWriter fornito e memorizza le informazioni di tracciatura relative al controllo se questa funzionalità è attivata. (Ereditato da Control)
Metodo protettoRenderControl(HtmlTextWriter, ControlAdapter)Restituisce il contenuto del controllo server a un oggetto HtmlTextWriter specificato utilizzando un oggetto ControlAdapter specificato. (Ereditato da Control)
Metodo protettoResolveAdapterOttiene l'adattatore del controllo responsabile del rendering del controllo specificato. (Ereditato da Control)
Metodo pubblicoResolveClientUrlOttiene un URL che può essere utilizzato dal browser. (Ereditato da Control)
Metodo pubblicoResolveUrlConverte un URL in un formato utilizzabile dal client richiedente. (Ereditato da Control)
Metodo protettoSaveControlStateInfrastruttura. Salva lo stato delle proprietà nel controllo DataPager che deve essere mantenuto tra un postback e l'altro, anche quando la proprietà EnableViewState è impostata su false. (Esegue l'override di Control..::.SaveControlState()()()).
Metodo protettoSaveViewStateSalva le eventuali modifiche apportate allo stato di visualizzazione di un controllo DataPager dopo l'ultimo postback della pagina al server. (Esegue l'override di Control..::.SaveViewState()()()).
Metodo protettoSetDesignModeStateImposta i dati della fase di progettazione per un controllo. (Ereditato da Control)
Metodo pubblicoSetPagePropertiesImposta le proprietà relative alla pagina nel controllo DataPager.
Metodo pubblicoSetRenderMethodDelegateInfrastruttura. Assegna un delegato del gestore eventi per eseguire il rendering del controllo server e del relativo contenuto nel controllo padre. (Ereditato da Control)
Metodo pubblicoToStringRestituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object)
Metodo protettoTrackViewStateTiene traccia delle variazioni dello stato di visualizzazione del controllo DataPager in modo che possano essere archiviate nell'oggetto StateBag del controllo. È possibile accedere a questo oggetto tramite la proprietà ViewState. (Esegue l'override di Control..::.TrackViewState()()()).
In alto
  NomeDescrizione
Evento pubblicoDataBindingViene generato quando il controllo server viene associato a un'origine dati. (Ereditato da Control)
Evento pubblicoDisposedSi verifica quando un controllo server viene rilasciato dalla memoria, ossia nell'ultima fase della durata di un controllo server quando viene richiesta una pagina ASP.NET. (Ereditato da Control)
Evento pubblicoInitViene generato quando il controllo server viene inizializzato, ovvero nella prima fase della sua durata. (Ereditato da Control)
Evento pubblicoLoadViene generato quando il controllo server è caricato nell'oggetto Page. (Ereditato da Control)
Evento pubblicoPreRenderSi verifica dopo il caricamento dell'oggetto Control ma prima del rendering. (Ereditato da Control)
Evento pubblicoUnloadViene generato quando il controllo server viene scaricato dalla memoria. (Ereditato da Control)
In alto
  NomeDescrizione
Metodo di estensione pubblicoEnableDynamicData(Type)Sottoposto a overload. Abilita il comportamento dati dinamici per il controllo dei dati specificato. (Definito da DataControlExtensions).
Metodo di estensione pubblicoEnableDynamicData(Type, Object)Sottoposto a overload. Abilita il comportamento dati dinamici per il controllo dei dati specificato. (Definito da DataControlExtensions).
Metodo di estensione pubblicoEnableDynamicData(Type, IDictionary<(Of <(String, Object>)>))Sottoposto a overload. Abilita il comportamento dati dinamici per il controllo dei dati specificato. (Definito da DataControlExtensions).
Metodo di estensione pubblicoFindDataSourceControlRestituisce l'origine dati associata al controllo dati per il controllo specificato. (Definito da DynamicDataExtensions).
Metodo di estensione pubblicoFindFieldTemplateRestituisce il modello di campo per la colonna specificata nel contenitore di denominazione del controllo specificato. (Definito da DynamicDataExtensions).
Metodo di estensione pubblicoFindMetaTableRestituisce l'oggetto metatabella per il controllo contenitore dei dati. (Definito da DynamicDataExtensions).
Metodo di estensione pubblicoGetDefaultValuesOttiene l'insieme di valori predefiniti per il controllo dei dati specificato. (Definito da DynamicDataExtensions).
Metodo di estensione pubblicoGetMetaTableOttiene i metadati della tabella per il controllo dei dati specificato. (Definito da DynamicDataExtensions).
Metodo di estensione pubblicoSetMetaTable(MetaTable)Sottoposto a overload. Imposta i metadati della tabella per il controllo dei dati specificato. (Definito da DynamicDataExtensions).
Metodo di estensione pubblicoSetMetaTable(MetaTable, IDictionary<(Of <(String, Object>)>))Sottoposto a overload. Imposta il mapping dei valori predefiniti e dei metadati della tabella per il controllo dei dati specificato. (Definito da DynamicDataExtensions).
Metodo di estensione pubblicoSetMetaTable(MetaTable, Object)Sottoposto a overload. Imposta il mapping dei valori predefiniti e dei metadati della tabella per il controllo dei dati specificato. (Definito da DynamicDataExtensions).
Metodo di estensione pubblicoTryGetMetaTableDetermina se sono disponibili i metadati della tabella. (Definito da DynamicDataExtensions).
In alto
  NomeDescrizione
Implementazione esplicita dell'interfacciaMetodo privatoIAttributeAccessor..::.GetAttributeInfrastruttura. Recupera il valore dell'attributo con il nome specificato dal controllo DataPager.
Implementazione esplicita dell'interfacciaMetodo privatoIAttributeAccessor..::.SetAttributeInfrastruttura. Imposta un attributo del controllo DataPager con il nome e il valore specificati.
Implementazione esplicita dell'interfacciaMetodo privatoICompositeControlDesignerAccessor..::.RecreateChildControlsInfrastruttura. Crea i controlli figlio del controllo DataPager in fase di progettazione.
Implementazione esplicita dell'interfacciaProprietà privataIControlBuilderAccessor..::.ControlBuilderPer una descrizione di questo membro, vedere IControlBuilderAccessor..::.ControlBuilder. (Ereditato da Control)
Implementazione esplicita dell'interfacciaMetodo privatoIControlDesignerAccessor..::.GetDesignModeStatePer una descrizione di questo membro, vedere IControlDesignerAccessor..::.GetDesignModeState. (Ereditato da Control)
Implementazione esplicita dell'interfacciaMetodo privatoIControlDesignerAccessor..::.SetDesignModeStatePer una descrizione di questo membro, vedere IControlDesignerAccessor..::.SetDesignModeState. (Ereditato da Control)
Implementazione esplicita dell'interfacciaMetodo privatoIControlDesignerAccessor..::.SetOwnerControlInfrastruttura. Per una descrizione di questo membro, vedere IControlDesignerAccessor..::.SetOwnerControl. (Ereditato da Control)
Implementazione esplicita dell'interfacciaProprietà privataIControlDesignerAccessor..::.UserDataPer una descrizione di questo membro, vedere IControlDesignerAccessor..::.UserData. (Ereditato da Control)
Implementazione esplicita dell'interfacciaProprietà privataIDataBindingsAccessor..::.DataBindingsPer una descrizione di questo membro, vedere IDataBindingsAccessor..::.DataBindings. (Ereditato da Control)
Implementazione esplicita dell'interfacciaProprietà privataIDataBindingsAccessor..::.HasDataBindingsPer una descrizione di questo membro, vedere IDataBindingsAccessor..::.HasDataBindings. (Ereditato da Control)
Implementazione esplicita dell'interfacciaProprietà privataIExpressionsAccessor..::.ExpressionsPer una descrizione di questo membro, vedere IExpressionsAccessor..::.Expressions. (Ereditato da Control)
Implementazione esplicita dell'interfacciaProprietà privataIExpressionsAccessor..::.HasExpressionsPer una descrizione di questo membro, vedere IExpressionsAccessor..::.HasExpressions. (Ereditato da Control)
Implementazione esplicita dell'interfacciaMetodo privatoIParserAccessor..::.AddParsedSubObjectPer una descrizione di questo membro, vedere IParserAccessor..::.AddParsedSubObject. (Ereditato da Control)
In alto

In questo argomento:

Introduzione

La classe DataPager viene utilizzata per eseguire il paging dei dati e per visualizzare i controlli per lo spostamento relativi ai controlli con associazione a dati che implementano l'interfaccia IPageableItemContainer. Un esempio di controllo che implementa l'interfaccia è rappresentato da ListView.

È possibile associare il controllo DataPager al controllo con associazione a dati utilizzando la proprietà PagedControlID. In alternativa, è possibile inserire il controllo DataPager nella gerarchia di controlli con associazione a dati. Nel controllo ListView, ad esempio, è possibile inserire il controllo DataPager all'interno del modello ListView..::.LayoutTemplate.

È possibile personalizzare il numero di elementi visualizzati per ogni pagina di dati modificando la proprietà PageSize nonché modificare la modalità di invio di una pagina al server impostando la proprietà QueryStringField.

Campi del pager

Per far sì che il controllo DataPager visualizzi i controlli per lo spostamento, è necessario aggiungere campi del pager al controllo stesso. Tali campi derivano dalla classe DataPagerField. Nella tabella riportata di seguito sono elencati i tipi di campi del pager che è possibile utilizzare.

Tipo di campo del pager

Oggetto di descrizione

NextPreviousPagerField

Consente agli utenti di spostarsi tra le pagine di dati una pagina alla volta o di passare alla prima o all'ultima pagina.

NumericPagerField

Consente agli utenti di selezionare una pagina in base al numero di pagina.

TemplatePagerField

Consente di creare un'interfaccia di paging personalizzata.

Per aggiungere campi del pager in modo dichiarativo al controllo DataPager, aggiungere un elemento Fields al controllo stesso. Sarà quindi possibile aggiungere i campi del pager all'elemento Fields. I campi vengono aggiunti all'insieme Fields nell'ordine in cui vengono visualizzati nell'elemento Fields. L'insieme Fields consente di gestire a livello di codice i campi del pager nel controllo DataPager.

Proprietà della pagina

Nella tabella riportata di seguito sono elencate le proprietà in sola lettura del controllo DataPager che specificano le caratteristiche della pagina di dati. Tali proprietà in genere vengono utilizzate per l'associazione di espressioni nell'oggetto TemplatePagerField.

Property

Oggetto di descrizione

MaximumRows

Numero massimo di record visualizzati per ogni pagina di dati.

StartRowIndex

Indice del primo record visualizzato in una pagina di dati.

TotalRowCount

Numero totale di record disponibili nell'origine dati sottostante.

Accessibilità

Il markup predefinito, che viene reso predefinito per questo controllo, potrebbe non essere conforme agli standard di accessibilità, ad esempio le linee guida WCAG (Web Content Accessibility Guidelines) 1.0 livello 1. Per informazioni dettagliate sul supporto dell'accessibilità per questo controllo, vedere Controlli ASP.NET e accessibilità.

Sintassi dichiarativa

<asp:DataPager
    EnableTheming="True|False"
    EnableViewState="True|False"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    PagedControlID="string"
    PageSize="integer"
    runat="server"
    SkinID="string"
    Visible="True|False"
>
        <Fields>
            <asp:NextPreviousPagerField
                ButtonCssClass="string"
                ButtonType="Button|Image|Link"
                FirstPageImageUrl="string"
                FirstPageText="string"
                LastPageImageUrl="string"
                LastPageText="string"
                NextPageImageUrl="string"
                NextPageText="string"
                PreviousPageImageUrl="string"
                PreviousPageText="string"
                RenderDisabledButtonsAsLabels="True|False"
                RenderNonBreakingSpacesBetweenControls="True|False"
                ShowFirstPageButton="True|False"
                ShowLastPageButton="True|False"
                ShowNextPageButton="True|False"
                ShowPreviousPageButton="True|False"
                Visible="True|False"
            />
            <asp:NumericPagerField
                ButtonCount="integer"
                ButtonType="Button|Image|Link"
                CurrentPageLabelCssClass="string"
                NextPageImageUrl="string"
                NextPageText="string"
                NextPreviousButtonCssClass="string"
                NumericButtonCssClass="string"                 PreviousPageImageUrl="string"
                PreviousPageText="string"
                RenderNonBreakingSpacesBetweenControls="True|False"
                Visible="True|False"
            />
            <asp:TemplatePagerField
                OnPagerCommand="PagerCommand event handler"
                Visible="True|False"
            />
        </Fields>
</asp:DataPager>

Nell'esempio riportato di seguito viene illustrato come aggiungere la funzionalità di paging a un controllo ListView. In questo esempio vengono illustrati due controlli DataPager utilizzati per spostarsi tra le pagine di dati dello stesso controllo ListView.

Visual Basic
<%@ Page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html  >
  <head id="Head1" runat="server">
    <title>DataPager Example</title>
    <style type="text/css">        
      th
      {
        background-color:#eef4fa;
        border-top:solid 1px #9dbbcc;
        border-bottom:solid 1px #9dbbcc;
      }
      .itemSeparator { border-right: 1px solid #ccc }
      .groupSeparator
      {
        height: 1px;
        background-color: #cccccc;
      }
    </style>
</head>
<body>
    <form id="form1" runat="server">

      <h3>DataPager Example</h3>

      <!-- The first DataPager control. -->
      <asp:DataPager runat="server" ID="BeforeListDataPager"
        PagedControlID="ProductsListView" 
        PageSize="18">
        <Fields>
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            FirstPageImageUrl="~/images/first.gif" />
          <asp:NumericPagerField ButtonCount="10" />
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            LastPageImageUrl="~/images/last.gif" />
        </Fields>
      </asp:DataPager>

      <asp:ListView ID="ProductsListView" 
        DataSourceID="ProductsDataSource" 
        GroupItemCount="3"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" id="tbl1" runat="server">
            <tr>
              <th colspan="5">PRODUCTS LIST</th>
            </tr>
            <tr runat="server" id="groupPlaceholder"></tr>
          </table>
        </LayoutTemplate>
        <GroupTemplate>
          <tr runat="server" id="tr1">
            <td runat="server" id="itemPlaceholder"></td>
          </tr>
        </GroupTemplate>
        <GroupSeparatorTemplate>
          <tr runat="server">
            <td colspan="5">
                <div class="groupSeparator"><hr></div>
              </td>
          </tr>
        </GroupSeparatorTemplate>
        <ItemTemplate>
          <td align="center" runat="server">
            <asp:HyperLink ID="ProductLink" runat="server" 
              Text='<%# Eval("Name") %>' 
              NavigateUrl='<%# "ProductDetails.aspx?productID=" & Eval("ProductID") %>' /><br />
            <asp:Image ID="ProductImage" runat="server"
              ImageUrl='<%#"~/images/thumbnails/" & Eval("ThumbnailPhotoFileName") %>' /><br />
            <b>Price:</b> <%# Eval("ListPrice", "{0:c}")%> <br />
          </td>
        </ItemTemplate>
        <ItemSeparatorTemplate>
          <td class="itemSeparator" runat="server">&nbsp;</td>
        </ItemSeparatorTemplate>
      </asp:ListView>

      <!-- The second DataPager control. -->
      <asp:DataPager runat="server" ID="AfterListDataPager"
        PagedControlID="ProductsListView" 
        PageSize="18">
        <Fields>
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            FirstPageImageUrl="~/images/first.gif" />
          <asp:NumericPagerField ButtonCount="10" />
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            LastPageImageUrl="~/images/last.gif" />
        </Fields>
      </asp:DataPager>

      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->
      <asp:SqlDataSource ID="ProductsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"                        
        SelectCommand="SELECT P.ProductID, P.Name, P.Color, P.ListPrice, 
          PF.ThumbnailPhotoFileName
          FROM Production.Product AS P 
          INNER JOIN Production.ProductProductPhoto AS PPF ON P.ProductID = PPF.ProductID 
          INNER JOIN Production.ProductPhoto AS PF ON PPF.ProductPhotoID = PF.ProductPhotoID">
      </asp:SqlDataSource>

    </form>
  </body>
</html>
C#
<%@ Page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html  >
  <head id="Head1" runat="server">
    <title>DataPager Example</title>
    <style type="text/css">        
      th
      {
        background-color:#eef4fa;
        border-top:solid 1px #9dbbcc;
        border-bottom:solid 1px #9dbbcc;
      }
      .itemSeparator { border-right: 1px solid #ccc }
      .groupSeparator
      {
        height: 1px;
        background-color: #cccccc;
      }
    </style>
</head>
<body>
    <form id="form1" runat="server">

      <h3>DataPager Example</h3>

      <!-- The first DataPager control. -->
      <asp:DataPager runat="server" ID="BeforeListDataPager"
        PagedControlID="ProductsListView" 
        PageSize="18">
        <Fields>
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            FirstPageImageUrl="~/images/first.gif" />
          <asp:NumericPagerField ButtonCount="10" />
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            LastPageImageUrl="~/images/last.gif" />
        </Fields>
      </asp:DataPager>

      <asp:ListView ID="ProductsListView" 
        DataSourceID="ProductsDataSource" 
        GroupItemCount="3"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" id="tbl1" runat="server">
            <tr>
              <th colspan="5">PRODUCTS LIST</th>
            </tr>
            <tr runat="server" id="groupPlaceholder"></tr>
          </table>
        </LayoutTemplate>
        <GroupTemplate>
          <tr runat="server" id="tr1">
            <td runat="server" id="itemPlaceholder"></td>
          </tr>
        </GroupTemplate>
        <GroupSeparatorTemplate>
          <tr runat="server">
            <td colspan="5">
                <div class="groupSeparator"><hr></div>
              </td>
          </tr>
        </GroupSeparatorTemplate>
        <ItemTemplate>
          <td align="center" runat="server">
            <asp:HyperLink ID="ProductLink" runat="server" 
              Text='<%# Eval("Name") %>' 
              NavigateUrl='<%# "ProductDetails.aspx?productID=" + Eval("ProductID") %>' /><br />
            <asp:Image ID="ProductImage" runat="server"
              ImageUrl='<%#"~/images/thumbnails/" + Eval("ThumbnailPhotoFileName") %>' /><br />
            <b>Price:</b> <%# Eval("ListPrice", "{0:c}")%> <br />
          </td>
        </ItemTemplate>
        <ItemSeparatorTemplate>
          <td class="itemSeparator" runat="server">&nbsp;</td>
        </ItemSeparatorTemplate>
      </asp:ListView>

      <!-- The second DataPager control. -->
      <asp:DataPager runat="server" ID="AfterListDataPager"
        PagedControlID="ProductsListView" 
        PageSize="18">
        <Fields>
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowFirstPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            FirstPageImageUrl="~/images/first.gif" />
          <asp:NumericPagerField ButtonCount="10" />
          <asp:NextPreviousPagerField ButtonType="Image"
            ShowLastPageButton="true"
            ShowNextPageButton="false"
            ShowPreviousPageButton="false"
            LastPageImageUrl="~/images/last.gif" />
        </Fields>
      </asp:DataPager>

      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->
      <asp:SqlDataSource ID="ProductsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"                        
        SelectCommand="SELECT P.ProductID, P.Name, P.Color, P.ListPrice, 
          PF.ThumbnailPhotoFileName
          FROM Production.Product AS P 
          INNER JOIN Production.ProductProductPhoto AS PPF ON P.ProductID = PPF.ProductID 
          INNER JOIN Production.ProductPhoto AS PF ON PPF.ProductPhotoID = PF.ProductPhotoID">
      </asp:SqlDataSource>

    </form>
  </body>
</html>

.NET Framework

Supportato in: 4, 3.5

Windows 7, Windows Vista SP1 o versione successiva, Windows XP SP3, Windows Server 2008 (componenti di base del server non supportati), Windows Server 2008 R2 (componenti di base del server supportati con SP1 o versione successiva), Windows Server 2003 SP2

.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Qualsiasi membro static (Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.
Contenuti della community   Che cos'è Contenuti della community?
Aggiungi nuovo contenuto RSS  Annotazioni
Processing
© 2012 Microsoft. Tutti i diritti riservati. Condizioni per l'utilizzo | Marchi | Informativa sulla privacy
Page view tracker