Home > DeveloperSection > Articles > DataPager Control in ASP.Net

DataPager Control in ASP.Net

ADO.Net ADO.Net 
0 Comment(s)
 8314  View(s)
Rate this:

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.



Maximum Rows

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


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


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


<asp:DataPager runat="server" ID="EmployeesDataPager" PageSize="1" PagedControlID="ListView1"



            <asp:NumericPagerField />




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");




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

DataPager Control in ASP.Net

Don't want to miss updates? Please click the below button!

Follow MindStick