Agnel Kurian
Agnel Kurian

Reputation: 59466

Unbound tabular data in RDLC

I need to display some tabular data in an RDLC which is not sourced from any dataset. I need the table only for formatting purposes. So I created the table and designed it around my content (which is passed in via parameters).

Table in RDLC

Now I get a compile time error saying:

"error rsDataRegionWithoutDataSet: The tablix ‘Tablix1’ is in the report body but the report has no dataset. Data regions are not allowed in reports without datasets."

How do I go about displaying unbound tabular data in an RDLC based report?

Upvotes: 0

Views: 3931

Answers (2)

JP Tétreault
JP Tétreault

Reputation: 600

To add a dummy dataset:

  1. Open your RDLC using Visual Studio
  2. On the left, open the Report Data window
  3. Click on New / Dataset­...
  4. Pick any table in your database, it does not matter
  5. Name your dataset DataSet1 to match to code below
  6. Add this in your code near where you add your parameters:

    report = new LocalReport();
    ...
    report.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", new DataTable()));
    ...
    report.Refresh();
    

Upvotes: 1

Raphael
Raphael

Reputation: 1687

You should use a dummy dataset to bind to the matrix, because table requires to be bound to a dataset.

Otherwise what I would to do what you are looking for is to use textboxes and place them together, you'll get the same result. And If you need to keep them together (in case of a page break) you could embed the textboxes inside of a rectangle.

Upvotes: 0

Related Questions