Mugume David
Mugume David

Reputation: 41

Dynamic columns in C# rdlc report

Suppose I have a report that lists employees (as rows) with their respective taxes charged (in columns). It is possible for a new tax to come up. Since my rdlc report file is currently designed (from XML of-course) to statically generate the columns. A future shift in events will need me to alter the rdlc file and add in a new column. How can I do this dynamically? I intend to avoid opening the rdlc file and adding XML code.

Upvotes: 4

Views: 7287

Answers (1)

Jaroslav Jandek
Jaroslav Jandek

Reputation: 9563

The best option is to simply do it manually, since it does not seem to happen often. Especially if you are using the RDLC editor in VS2008.

You can use the Matrix control instead of the Table control. Matrix will - based on grouping - generate the appropriate columns and rows. You will have to modify your query and it will be a bit slower as well.

You can use the Table or List control with parametrically hidden columns.

You can automatically modify the report's XML based on how many columns you need. Since RDLC is an xml file, it is trivial.

Upvotes: 3

Related Questions