Remove Hidden TextBox white (empty) space from ASP.Net RDLC Report using C# and VB.Net

on Apr 12, 2021 04:48 AM

Hi all

In my rdlc report I am hiding a TextBox depending on the expression but the problem is that when it is visible none it is keeping white space.

Any idea how to remove this white space?

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Apr 13, 2021 01:35 AM

Hi rakibxl,

You need to set RowVisibility property of your Table Row to hide the blank space.

For implement RDLC refer below article.

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


For this example I have used of Northwind database that you can download using the link given below.

Download Northwind Database



In the below example i have placed two table.

In that first table i have set the TextBox visible property.

In the 2nd i have set the Row Visibility.. property.



protected void Page_Load(object sender, EventArgs e)
    if (!IsPostBack)
        ReportViewer1.ProcessingMode = ProcessingMode.Local;
        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
        Customers dsCustomers = GetData("select top 5 * from customers");
        ReportDataSource datasource = new ReportDataSource("Customers", dsCustomers.Tables[0]);
private Customers GetData(string query)
    string conString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
    SqlCommand cmd = new SqlCommand(query);
    using (SqlConnection con = new SqlConnection(conString))
        using (SqlDataAdapter sda = new SqlDataAdapter())
            cmd.Connection = con;
            sda.SelectCommand = cmd;
            using (Customers dsCustomers = new Customers())
                sda.Fill(dsCustomers, "DataTable1");
                return dsCustomers;


Protected Sub Page_Load(sender As Object, 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("select top 5 * from customers")
        Dim datasource As New ReportDataSource("Customers", dsCustomers.Tables(0))
    End If
End Sub

Private Function GetData(query As String) As Customers
    Dim conString As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
    Dim cmd As New SqlCommand(query)
    Using con As New SqlConnection(conString)
        Using sda As New SqlDataAdapter()
            cmd.Connection = con
            sda.SelectCommand = cmd
            Using dsCustomers As New Customers()
                sda.Fill(dsCustomers, "DataTable1")
                Return dsCustomers
            End Using
        End Using
    End Using
End Function


In the screenshot you will see the left table has empty space where as in right table empty space removed.