asp.net.ph

Skip Navigation Links

Specifying Paging Behavior in a DetailsView Control

Controls You Can Use on Web Forms   ASP.NET Data Controls   DetailsView Control


The DetailsView Web server control enables paging thru the records in the data source using any of the following methods:

  • Default paging using built-in paging controls
  • Default paging using custom navigation controls
  • Custom paging

To specify default paging using the built-in paging controls

  1. Set the control’s AllowPaging property to true.
<asp:detailsview id="planDetails" runat="server"
   datasourceid="plans"
   allowpaging=true
   ...
>

or simply

<asp:detailsview id="planDetails" runat="server"
   datasourceid="plans"
   allowpaging
   ...
>
DetailsView with Default Paging
Run Sample | View Source

The DetailsView control includes properties for customizing the default pager style.

To set the behavior and appearance of the pager buttons

  1. Within the DetailsView declaration, declare a <PagerSettings> element.
  2. Within the PagerSettings element, define each of the properties you intend to customize. For syntax, see DetailsView Control Syntax.
    <pagersettings
          mode="nextprevious"
          nextpagetext="Next" 
          previouspagetext="Back" 
          position="top"
          pagebuttoncount=10 />
  3. Also within the DetailsView declaration, declare a <PagerStyle> element.
  4. Within the PagerStyle element, define each of the properties you intend to customize. For syntax, see DetailsView Control Syntax.
    <pagerstyle
          backcolor="steelblue" 
          forecolor="beige"
          horizontalalign="right" />
DetailsView PagerSettings, PagerStyle Example
Run Sample | View Source

See Also

Specifying Row Format in a DetailsView Control   Allowing Users to Add Rows in a DetailsView Control



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note