---
title: "DataPager Control in ASP.Net"  
description: "DataPager control can be associated with the data-bound control by using the PagedControlID property. Alternatively, by putting the DataPager control"  
author: "Pushpendra Singh"  
published: 2010-11-08  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/194/datapager-control-in-asp-dot-net  
category: "ado.net"  
tags: ["ado.net"]  
reading_time: 2 minutes  

---

# DataPager Control in ASP.Net

DataPager control can be associated with the data-bound control by using the PagedControlID property. Alternatively, by putting the DataPager control inside the data-bound control hierarchy. For example, in the ListView control, DataPager control can be kept inside the ListView-Layout Template. The number of items that are displayed for each page of data can be customized by changing the Page Size property. The way a page is submitted to the server can be changed by setting the QueryStringField property.\

##### 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 |
| --- | --- |
| Maximum Rows | 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. |

```
<asp:DataPager runat="server" ID="EmployeesDataPager" PageSize="1" PagedControlID="ListView1"         OnPreRender="EmployeesDataPager_PreRender">         <Fields>            <asp:NumericPagerField />                  </Fields></asp:DataPager>
```

##### Bind Data in DataPager PreRender event

##### Write below code in DataPager PreRender event

```
protected void EmployeesDataPager_PreRender(object sender,  EventArgs e)    {         ListView1.DataSource = Class1.execute_spfill_grid("insert_reg");         ListView1.DataBind();      }
```

In above code execute_spfill_grid is a function created in Class1 and insert_reg is a stored procedure.\

![DataPager Control in ASP.Net](https://www.mindstick.com/mindstickarticle/a316760f-4bec-4e45-9e11-3b422eac99c8/images/a109cc38-df56-42e4-8037-83534f15c289.png)

\

---

Original Source: https://www.mindstick.com/articles/194/datapager-control-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
