Dinamic columns in table

Stimulsoft Reports.NET discussion
Post Reply
Lucas Pinto
Posts: 6
Joined: Wed Apr 13, 2011 2:24 pm

Dinamic columns in table

Post by Lucas Pinto »

Hi,

I would like to know if it is possible to create a table with dinamic columns, these columns are created according to one field of my dataset. For example:
The field "countries" returns the values: USA, Brazil, England and France... but more countries can be added to the field by the user, so I'll need to add a new column for each contry added.
Can I do this in the report?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Dinamic columns in table

Post by Alex K. »

Hello,

Maybe we did not completely understand your question, in the future you want to do with this table.
You can use the following code to create this table:

Code: Select all

DataTable dt = new DataTable();
foreach (DataRow row in DataSourceName.Rows)
{
    dt.Columns.Add(row["CountryName"]);
}
Thank you.
Post Reply