.NET Framework Class Library DataPager Class

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

Syntax
<ThemeableAttribute(True)> _
<ToolboxBitmapAttribute(GetType(DataPager), "DataPager.bmp")> _
Public Class DataPager _
Inherits Control _
Implements IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
[ThemeableAttribute(true)]
[ToolboxBitmapAttribute(typeof(DataPager), "DataPager.bmp")]
public class DataPager : Control, IAttributeAccessor,
INamingContainer, ICompositeControlDesignerAccessor
[ThemeableAttribute(true)]
[ToolboxBitmapAttribute(typeof(DataPager), L"DataPager.bmp")]
public ref class DataPager : public Control,
IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
[<ThemeableAttribute(true)>]
[<ToolboxBitmapAttribute(typeof(DataPager), "DataPager.bmp")>]
type DataPager =
class
inherit Control
interface IAttributeAccessor
interface INamingContainer
interface ICompositeControlDesignerAccessor
end
The DataPager type exposes the following members.

Constructors
|
| Name | Description |
|---|
.gif) | DataPager | Initializes a new instance of the DataPager class. | Top

Methods
|
| Name | Description |
|---|
.gif) | AddAttributesToRender | Adds HTML attributes and styles to be rendered in the browser to the specified HtmlTextWriter object. | .gif) | AddedControl | Called after a child control is added to the Controls collection of the Control object. (Inherited from Control.) | .gif) | AddParsedSubObject | Notifies 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.) | .gif) | ApplyStyleSheetSkin | Applies the style properties defined in the page style sheet to the control. (Inherited from Control.) | .gif) | BuildProfileTree | Infrastructure. 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.) | .gif) | ClearCachedClientID | Infrastructure. Sets the cached ClientID value to nullNothingnullptra null reference (Nothing in Visual Basic). (Inherited from Control.) | .gif) | ClearChildControlState | Deletes the control-state information for the server control's child controls. (Inherited from Control.) | .gif) | ClearChildState | Deletes the view-state and control-state information for all the server control's child controls. (Inherited from Control.) | .gif) | ClearChildViewState | Deletes the view-state information for all the server control's child controls. (Inherited from Control.) | .gif) | ClearEffectiveClientIDMode | Infrastructure. Sets the ClientIDMode property of the current control instance and of any child controls to Inherit. (Inherited from Control.) | .gif) | ConnectToEvents | Connects events to event handler methods in the DataPager control. | .gif) | CreateChildControls | Called 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.) | .gif) | CreateControlCollection | Creates a new ControlCollection object to hold the child controls (both literal and server) of the server control. (Inherited from Control.) | .gif) | CreatePagerFields | Creates the DataPagerField objects that are contained by the Fields property of the DataPager control. | .gif) | DataBind()()() | Binds the DataPager control and all its child controls to a data source. (Overrides Control..::.DataBind()()().) | .gif) | DataBind(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.) | .gif) | DataBindChildren | Binds a data source to the server control's child controls. (Inherited from Control.) | .gif) | Dispose | Enables a server control to perform final clean up before it is released from memory. (Inherited from Control.) | .gif) | EnsureChildControls | Determines whether the server control contains child controls. If it does not, it creates child controls. (Inherited from Control.) | .gif) | EnsureID | Creates an identifier for controls that do not have an identifier assigned. (Inherited from Control.) | .gif) | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | .gif) | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | .gif) | FindControl(String) | Searches the current naming container for a server control with the specified id parameter. (Inherited from Control.) | .gif) | FindControl(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.) | .gif) | FindPageableItemContainer | Retrieves the data-bound control that is associated with the DataPager control. | .gif) | Focus | Sets input focus to a control. (Inherited from Control.) | .gif) | GetDesignModeState | Infrastructure. Gets design-time data for a control. (Inherited from Control.) | .gif) | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | .gif) | GetRouteUrl(Object) | Gets the URL that corresponds to a set of route parameters. (Inherited from Control.) | .gif) | GetRouteUrl(RouteValueDictionary) | Gets the URL that corresponds to a set of route parameters. (Inherited from Control.) | .gif) | GetRouteUrl(String, Object) | Gets the URL that corresponds to a set of route parameters and a route name. (Inherited from Control.) | .gif) | GetRouteUrl(String, RouteValueDictionary) | Gets the URL that corresponds to a set of route parameters and a route name. (Inherited from Control.) | .gif) | GetType | Gets the Type of the current instance. (Inherited from Object.) | .gif) | GetUniqueIDRelativeTo | Returns the prefixed portion of the UniqueID property of the specified control. (Inherited from Control.) | .gif) | HasControls | Determines if the server control contains any child controls. (Inherited from Control.) | .gif) | HasEvents | Returns a value indicating whether events are registered for the control or any child controls. (Inherited from Control.) | .gif) | IsLiteralContent | Infrastructure. Determines if the server control holds only literal content. (Inherited from Control.) | .gif) | LoadControlState | Infrastructure. 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).) | .gif) | LoadViewState | Restores view-state information for the DataPager control that was saved by the SaveViewState method during a previous page request. (Overrides Control..::.LoadViewState(Object).) | .gif) | MapPathSecure | Retrieves the physical path that a virtual path, either absolute or relative, maps to. (Inherited from Control.) | .gif) | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | .gif) | OnBubbleEvent | Determines whether an event for the DataPager control is passed up the page's user interface (UI) server control hierarchy (Overrides Control..::.OnBubbleEvent(Object, EventArgs).) | .gif) | OnDataBinding | Raises the DataBinding event. (Inherited from Control.) | .gif) | OnInit | Infrastructure. Raises the Init event. (Overrides Control..::.OnInit(EventArgs).) | .gif) | OnLoad | Infrastructure. Raises the Load event. (Overrides Control..::.OnLoad(EventArgs).) | .gif) | OnPreRender | Raises the PreRender event. (Inherited from Control.) | .gif) | OnTotalRowCountAvailable | Handles the IPageableItemContainer..::.TotalRowCountAvailable event. | .gif) | OnUnload | Raises the Unload event. (Inherited from Control.) | .gif) | OpenFile | Gets a Stream used to read a file. (Inherited from Control.) | .gif) | RaiseBubbleEvent | Assigns any sources of the event and its information to the control's parent. (Inherited from Control.) | .gif) | RecreateChildControls | Creates child controls of the DataPager control at design time. | .gif) | RemovedControl | Called after a child control is removed from the Controls collection of the Control object. (Inherited from Control.) | .gif) | Render | Infrastructure. Sends the DataPager control content to the specified HtmlTextWriter object, which writes the content to be rendered to the browser. (Overrides Control..::.Render(HtmlTextWriter).) | .gif) | RenderBeginTag | Renders the HTML opening tag of the DataPager control to the specified writer. | .gif) | RenderChildren | Outputs 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.) | .gif) | RenderContents | Renders the contents of the DataPager control to the specified writer. | .gif) | RenderControl(HtmlTextWriter) | Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled. (Inherited from Control.) | .gif) | RenderControl(HtmlTextWriter, ControlAdapter) | Outputs server control content to a provided HtmlTextWriter object using a provided ControlAdapter object. (Inherited from Control.) | .gif) | ResolveAdapter | Gets the control adapter responsible for rendering the specified control. (Inherited from Control.) | .gif) | ResolveClientUrl | Gets a URL that can be used by the browser. (Inherited from Control.) | .gif) | ResolveUrl | Converts a URL into one that is usable on the requesting client. (Inherited from Control.) | .gif) | SaveControlState | Infrastructure. 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()()().) | .gif) | SaveViewState | Saves 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()()().) | .gif) | SetDesignModeState | Sets design-time data for a control. (Inherited from Control.) | .gif) | SetPageProperties | Sets the page-related properties in the DataPager control. | .gif) | SetRenderMethodDelegate | Infrastructure. Assigns an event handler delegate to render the server control and its content into its parent control. (Inherited from Control.) | .gif) | ToString | Returns a string that represents the current object. (Inherited from Object.) | .gif) | TrackViewState | Tracks 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

Extension Methods

Explicit Interface Implementations
|
| Name | Description |
|---|
.gif) .gif) | IAttributeAccessor..::.GetAttribute | Infrastructure. Retrieves the attribute value with the specified name from the DataPager control. | .gif) .gif) | IAttributeAccessor..::.SetAttribute | Infrastructure. Sets an attribute of the DataPager control with the specified name and value. | .gif) .gif) | ICompositeControlDesignerAccessor..::.RecreateChildControls | Infrastructure. Creates the child controls of the DataPager control at design time. | .gif) .gif) | IControlBuilderAccessor..::.ControlBuilder | For a description of this member, see IControlBuilderAccessor..::.ControlBuilder. (Inherited from Control.) | .gif) .gif) | IControlDesignerAccessor..::.GetDesignModeState | For a description of this member, see IControlDesignerAccessor..::.GetDesignModeState. (Inherited from Control.) | .gif) .gif) | IControlDesignerAccessor..::.SetDesignModeState | For a description of this member, see IControlDesignerAccessor..::.SetDesignModeState. (Inherited from Control.) | .gif) .gif) | IControlDesignerAccessor..::.SetOwnerControl | Infrastructure. For a description of this member, see IControlDesignerAccessor..::.SetOwnerControl. (Inherited from Control.) | .gif) .gif) | IControlDesignerAccessor..::.UserData | For a description of this member, see IControlDesignerAccessor..::.UserData. (Inherited from Control.) | .gif) .gif) | IDataBindingsAccessor..::.DataBindings | For a description of this member, see IDataBindingsAccessor..::.DataBindings. (Inherited from Control.) | .gif) .gif) | IDataBindingsAccessor..::.HasDataBindings | For a description of this member, see IDataBindingsAccessor..::.HasDataBindings. (Inherited from Control.) | .gif) .gif) | IExpressionsAccessor..::.Expressions | For a description of this member, see IExpressionsAccessor..::.Expressions. (Inherited from Control.) | .gif) .gif) | IExpressionsAccessor..::.HasExpressions | For a description of this member, see IExpressionsAccessor..::.HasExpressions. (Inherited from Control.) | .gif) .gif) | IParserAccessor..::.AddParsedSubObject | For a description of this member, see IParserAccessor..::.AddParsedSubObject. (Inherited from Control.) | Top

Remarks
In this topic: IntroductionThe 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 FieldsIn 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. 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 PropertiesThe 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. |
AccessibilityThe 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>

Examples
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.
<%@ 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"> </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>
<%@ 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"> </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>

Version Information
.NET FrameworkSupported in: 4, 3.5

Platforms
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.

Thread Safety
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also
|
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.

Gerarchia di ereditarietà
Spazio dei nomi:
System.Web.UI.WebControls
Assembly:
System.Web.Extensions (in System.Web.Extensions.dll)

Sintassi
<ThemeableAttribute(True)> _
<ToolboxBitmapAttribute(GetType(DataPager), "DataPager.bmp")> _
Public Class DataPager _
Inherits Control _
Implements IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
[ThemeableAttribute(true)]
[ToolboxBitmapAttribute(typeof(DataPager), "DataPager.bmp")]
public class DataPager : Control, IAttributeAccessor,
INamingContainer, ICompositeControlDesignerAccessor
[ThemeableAttribute(true)]
[ToolboxBitmapAttribute(typeof(DataPager), L"DataPager.bmp")]
public ref class DataPager : public Control,
IAttributeAccessor, INamingContainer, ICompositeControlDesignerAccessor
[<ThemeableAttribute(true)>]
[<ToolboxBitmapAttribute(typeof(DataPager), "DataPager.bmp")>]
type DataPager =
class
inherit Control
interface IAttributeAccessor
interface INamingContainer
interface ICompositeControlDesignerAccessor
end
Il tipo DataPager espone i seguenti membri.

Costruttori
|
| Nome | Descrizione |
|---|
.gif) | DataPager | Inizializza una nuova istanza della classe DataPager. | In alto

Metodi
|
| Nome | Descrizione |
|---|
.gif) | AddAttributesToRender | Aggiunge stili e attributi HTML dei quali è necessario eseguire il rendering nel browser nell'oggetto HtmlTextWriter specificato. | .gif) | AddedControl | Viene chiamato dopo che un controllo è stato aggiunto all'insieme Controls dell'oggetto Control. (Ereditato da Control) | .gif) | AddParsedSubObject | Notifica al controllo server che un elemento, XML o HTML, è stato analizzato e aggiunge l'elemento all'oggetto ControlCollection del controllo server. (Ereditato da Control) | .gif) | ApplyStyleSheetSkin | Applica al controllo le proprietà di stile definite nel foglio di stile della pagina. (Ereditato da Control) | .gif) | BuildProfileTree | Infrastruttura. 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) | .gif) | ClearCachedClientID | Infrastruttura. Imposta il valore memorizzato nella cache ClientID su nullNothingnullptrriferimento null (Nothing in Visual Basic). (Ereditato da Control) | .gif) | ClearChildControlState | Elimina le informazioni sullo stato del controllo per i controlli figlio del controllo server. (Ereditato da Control) | .gif) | ClearChildState | Elimina le informazioni sullo stato di visualizzazione e sullo stato del controllo per tutti i controlli figlio del controllo server. (Ereditato da Control) | .gif) | ClearChildViewState | Elimina le informazioni sullo stato di visualizzazione per tutti i controlli figlio del controllo server. (Ereditato da Control) | .gif) | ClearEffectiveClientIDMode | Infrastruttura. Imposta la proprietà ClientIDMode dell'istanza del controllo corrente e di tutti i controlli figlio su Inherit. (Ereditato da Control) | .gif) | ConnectToEvents | Connette eventi a metodi del gestore eventi nel controllo DataPager. | .gif) | CreateChildControls | Viene 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) | .gif) | CreateControlCollection | Crea un nuovo oggetto ControlCollection per contenere i controlli figlio (letterali e server) del controllo server. (Ereditato da Control) | .gif) | CreatePagerFields | Crea gli oggetti DataPagerField contenuti dalla proprietà Fields del controllo DataPager. | .gif) | DataBind()()() | Associa il controllo DataPager e tutti i controlli figlio a un'origine dati. (Esegue l'override di Control..::.DataBind()()()). | .gif) | DataBind(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) | .gif) | DataBindChildren | Associa un'origine dati al controllo server e ai relativi controlli figlio. (Ereditato da Control) | .gif) | Dispose | Abilita un controllo server alla pulizia finale prima che venga rilasciato dalla memoria. (Ereditato da Control) | .gif) | EnsureChildControls | Determina se il controllo server contiene controlli figlio. In caso contrario, li crea. (Ereditato da Control) | .gif) | EnsureID | Crea un identificatore per i controlli a cui non è assegnato alcun identificatore. (Ereditato da Control) | .gif) | Equals(Object) | Determina se l'oggetto Object specificato è uguale all'oggetto Object corrente. (Ereditato da Object) | .gif) | Finalize | Consente 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) | .gif) | FindControl(String) | Cerca un controllo server nel contenitore dei nomi corrente con il parametro id specificato. (Ereditato da Control) | .gif) | FindControl(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) | .gif) | FindPageableItemContainer | Recupera il controllo con associazione a dati associato al controllo DataPager. | .gif) | Focus | Imposta lo stato attivo per l'input su un controllo. (Ereditato da Control) | .gif) | GetDesignModeState | Infrastruttura. Ottiene i dati della fase di progettazione per un controllo. (Ereditato da Control) | .gif) | GetHashCode | Funge da funzione hash per un determinato tipo. (Ereditato da Object) | .gif) | GetRouteUrl(Object) | Ottiene l'URL corrispondente a un set di parametri di route. (Ereditato da Control) | .gif) | GetRouteUrl(RouteValueDictionary) | Ottiene l'URL corrispondente a un set di parametri di route. (Ereditato da Control) | .gif) | GetRouteUrl(String, Object) | Ottiene l'URL che corrisponde a un set di parametri di route e a un nome della route. (Ereditato da Control) | .gif) | GetRouteUrl(String, RouteValueDictionary) | Ottiene l'URL che corrisponde a un set di parametri di route e a un nome della route. (Ereditato da Control) | .gif) | GetType | Ottiene l'oggetto Type dell'istanza corrente. (Ereditato da Object) | .gif) | GetUniqueIDRelativeTo | Restituisce la parte con prefisso della proprietà UniqueID del controllo specificato. (Ereditato da Control) | .gif) | HasControls | Determina se il controllo server contiene controlli figlio. (Ereditato da Control) | .gif) | HasEvents | Restituisce un valore che indica se gli eventi vengono registrati per il controllo o eventuali controlli figlio. (Ereditato da Control) | .gif) | IsLiteralContent | Infrastruttura. Determina se il controllo server conserva solo il contenuto literal. (Ereditato da Control) | .gif) | LoadControlState | Infrastruttura. 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)). | .gif) | LoadViewState | Ripristina 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)). | .gif) | MapPathSecure | Recupera il percorso fisico al quale è associato un percorso virtuale, assoluto o relativo. (Ereditato da Control) | .gif) | MemberwiseClone | Consente di creare una copia dei riferimenti dell'oggetto Object corrente. (Ereditato da Object) | .gif) | OnBubbleEvent | Determina 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)). | .gif) | OnDataBinding | Genera l'evento DataBinding. (Ereditato da Control) | .gif) | OnInit | Infrastruttura. Genera l'evento Init. (Esegue l'override di Control..::.OnInit(EventArgs)). | .gif) | OnLoad | Infrastruttura. Genera l'evento Load. (Esegue l'override di Control..::.OnLoad(EventArgs)). | .gif) | OnPreRender | Genera l'evento PreRender. (Ereditato da Control) | .gif) | OnTotalRowCountAvailable | Consente di gestire l'evento IPageableItemContainer..::.TotalRowCountAvailable. | .gif) | OnUnload | Genera l'evento Unload. (Ereditato da Control) | .gif) | OpenFile | Ottiene un oggetto Stream utilizzato per leggere un file. (Ereditato da Control) | .gif) | RaiseBubbleEvent | Assegna eventuali origini dell'evento e relative informazioni al controllo padre. (Ereditato da Control) | .gif) | RecreateChildControls | Crea controlli figlio del controllo DataPager in fase di progettazione. | .gif) | RemovedControl | Viene chiamato dopo la rimozione di un controllo figlio dall'insieme Controls dell'oggetto Control. (Ereditato da Control) | .gif) | Render | Infrastruttura. 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)). | .gif) | RenderBeginTag | Esegue il rendering del tag HTML di apertura del controllo DataPager nel writer specificato. | .gif) | RenderChildren | Invia 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) | .gif) | RenderContents | Esegue il rendering del contenuto del controllo DataPager nel writer specificato. | .gif) | RenderControl(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) | .gif) | RenderControl(HtmlTextWriter, ControlAdapter) | Restituisce il contenuto del controllo server a un oggetto HtmlTextWriter specificato utilizzando un oggetto ControlAdapter specificato. (Ereditato da Control) | .gif) | ResolveAdapter | Ottiene l'adattatore del controllo responsabile del rendering del controllo specificato. (Ereditato da Control) | .gif) | ResolveClientUrl | Ottiene un URL che può essere utilizzato dal browser. (Ereditato da Control) | .gif) | ResolveUrl | Converte un URL in un formato utilizzabile dal client richiedente. (Ereditato da Control) | .gif) | SaveControlState | Infrastruttura. 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()()()). | .gif) | SaveViewState | Salva 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()()()). | .gif) | SetDesignModeState | Imposta i dati della fase di progettazione per un controllo. (Ereditato da Control) | .gif) | SetPageProperties | Imposta le proprietà relative alla pagina nel controllo DataPager. | .gif) | SetRenderMethodDelegate | Infrastruttura. Assegna un delegato del gestore eventi per eseguire il rendering del controllo server e del relativo contenuto nel controllo padre. (Ereditato da Control) | .gif) | ToString | Restituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object) | .gif) | TrackViewState | Tiene 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

Metodi di estensione

Implementazioni esplicite dell'interfaccia
|
| Nome | Descrizione |
|---|
.gif) .gif) | IAttributeAccessor..::.GetAttribute | Infrastruttura. Recupera il valore dell'attributo con il nome specificato dal controllo DataPager. | .gif) .gif) | IAttributeAccessor..::.SetAttribute | Infrastruttura. Imposta un attributo del controllo DataPager con il nome e il valore specificati. | .gif) .gif) | ICompositeControlDesignerAccessor..::.RecreateChildControls | Infrastruttura. Crea i controlli figlio del controllo DataPager in fase di progettazione. | .gif) .gif) | IControlBuilderAccessor..::.ControlBuilder | Per una descrizione di questo membro, vedere IControlBuilderAccessor..::.ControlBuilder. (Ereditato da Control) | .gif) .gif) | IControlDesignerAccessor..::.GetDesignModeState | Per una descrizione di questo membro, vedere IControlDesignerAccessor..::.GetDesignModeState. (Ereditato da Control) | .gif) .gif) | IControlDesignerAccessor..::.SetDesignModeState | Per una descrizione di questo membro, vedere IControlDesignerAccessor..::.SetDesignModeState. (Ereditato da Control) | .gif) .gif) | IControlDesignerAccessor..::.SetOwnerControl | Infrastruttura. Per una descrizione di questo membro, vedere IControlDesignerAccessor..::.SetOwnerControl. (Ereditato da Control) | .gif) .gif) | IControlDesignerAccessor..::.UserData | Per una descrizione di questo membro, vedere IControlDesignerAccessor..::.UserData. (Ereditato da Control) | .gif) .gif) | IDataBindingsAccessor..::.DataBindings | Per una descrizione di questo membro, vedere IDataBindingsAccessor..::.DataBindings. (Ereditato da Control) | .gif) .gif) | IDataBindingsAccessor..::.HasDataBindings | Per una descrizione di questo membro, vedere IDataBindingsAccessor..::.HasDataBindings. (Ereditato da Control) | .gif) .gif) | IExpressionsAccessor..::.Expressions | Per una descrizione di questo membro, vedere IExpressionsAccessor..::.Expressions. (Ereditato da Control) | .gif) .gif) | IExpressionsAccessor..::.HasExpressions | Per una descrizione di questo membro, vedere IExpressionsAccessor..::.HasExpressions. (Ereditato da Control) | .gif) .gif) | IParserAccessor..::.AddParsedSubObject | Per una descrizione di questo membro, vedere IParserAccessor..::.AddParsedSubObject. (Ereditato da Control) | In alto

Note
In questo argomento: IntroduzioneLa 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 paginaNella 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>

Esempi
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.
<%@ 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"> </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>
<%@ 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"> </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>

Informazioni sulla versione
.NET FrameworkSupportato in: 4, 3.5

Piattaforme
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.

Codice thread safe
Qualsiasi membro static ( Shared in Visual Basic) pubblico di questo tipo è thread-safe. I membri di istanza non sono garantiti come thread-safe.

Vedere anche
|