asp.net.ph

Skip Navigation Links

Specifying Paging Behavior in a FormView Control

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


The FormView 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:formview id="productSpecs" runat="server"
   datasourceid="products"
   allowpaging=true
   ...
>

or simply

<asp:formview id="productSpecs" runat="server"
   datasourceid="products"
   allowpaging
   ...
>
FormView with Default Paging
Run Sample | View Source

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

To set the behavior and appearance of the pager buttons

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

See Also

Specifying Row Format in a FormView 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