Set number of records per page in ASP.Net RDLC Report using C# and VB.Net

on Jul 10, 2022 11:14 PM

How I can create a report with 2 records on each page of RDLC.

Please help I am trying create a student report but on what report i would like to display at least two student details per page.

Please help.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Jul 13, 2022 12:35 AM
on Jul 13, 2022 12:36 AM

Hi makumbi,

For configuring abd binding the RDLC report refer below article.

RDLC (Local SSRS) Report ASP.Net Example using DataSet or DataTable in C# VB.Net and Visual Studio 2010


<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="150">



using System.Data;
using Microsoft.Reporting.WebForms;


Imports System.Data
Imports Microsoft.Reporting.WebForms



protected void Page_Load(object sender, EventArgs e)
    if (!IsPostBack)
        ReportViewer1.ProcessingMode = ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
        Customers dsCustomers = GetData();
        ReportDataSource datasource = new ReportDataSource("Customers", dsCustomers.Tables[0]);

private Customers GetData()
    DataTable dt = new DataTable();
    dt.Columns.AddRange(new DataColumn[3] {
        new DataColumn("Id", typeof(int)),
        new DataColumn("Name", typeof(string)),
        new DataColumn("Country",typeof(string)) });
    dt.Rows.Add(1, "John Hammond", "United States");
    dt.Rows.Add(2, "Mudassar Khan", "India");
    dt.Rows.Add(3, "Suzanne Mathews", "France");
    dt.Rows.Add(4, "Robert Schidner", "Russia");
    Customers dsCustomers = new Customers();
    foreach (DataRow dr in dt.Rows)
        dsCustomers.DataTable1.Rows.Add(dr["Id"], dr["Name"], dr["Country"]);

    return dsCustomers;


Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    If Not IsPostBack Then
        ReportViewer1.ProcessingMode = ProcessingMode.Local
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc")
        Dim dsCustomers As Customers = GetData()
        Dim datasource As ReportDataSource = New ReportDataSource("Customers", dsCustomers.Tables(0))
    End If
End Sub

Private Function GetData() As Customers
    Dim dt As DataTable = New DataTable()
    dt.Columns.AddRange(New DataColumn(2) {
                        New DataColumn("Id", GetType(Integer)),
                        New DataColumn("Name", GetType(String)),
                        New DataColumn("Country", GetType(String))})
    dt.Rows.Add(1, "John Hammond", "United States")
    dt.Rows.Add(2, "Mudassar Khan", "India")
    dt.Rows.Add(3, "Suzanne Mathews", "France")
    dt.Rows.Add(4, "Robert Schidner", "Russia")
    Dim dsCustomers As Customers = New Customers()
    For Each dr As DataRow In dt.Rows
        dsCustomers.DataTable1.Rows.Add(dr("Id"), dr("Name"), dr("Country"))
    Return dsCustomers
End Function

After the configuration done follow the below steps in order to show two records per page. For that you need to add Row Group which is a Parent of the existing group.

Then in the Group By expression you need to write the following expression.


Note: 2 specifies that the number of record to be displayed per page. You can specify any number as per your need.

For adding the Group follow the below steps.

1. In the report designer Right click on the table row select Add Group and then Parent Group.

2. In the Tablix group write the expression =CEILING(RowNumber(Nothing)/2) and leave the Add group header & Add group footer CheckBox unchecked.

3. Then Right click on the Group cell and select Row Group and then Group Properties…

4. In the Group Properties window select Page Breaks tab and check the Between each instance of a group.

5. Again in the Group Properties window select Sorting tab and in Change sorting options select Sort by and click Delete then Ok.

6. Then in the report designer Right click the Group column and select Delete Columns.

7. From the Delete Columns window choose the 2nd radio button Delete columns only option and click Ok.

8. Finally report designer look like below.