Adding columns to a databand at runtime

Stimulsoft Reports.NET discussion
Post Reply
josc
Posts: 11
Joined: Mon Nov 13, 2006 5:15 pm

Adding columns to a databand at runtime

Post by josc »


I'm trying to add columns from a datasource to a databand at runtime.
I'm using the produced csharp file of the report in my project, because it allows me to
access the report in a typed manner.

This is the code : (ReportData is a dataset loaded previously)

using Stimulsoft.Report.Components;
using Stimulsoft.Base.Drawing;

Reports.TestReport Rapport = new Reports.TestReport();
Rapport.RegData("tdsReport",ReportData);

Rapport.BandLanguages.DataSourceName = "tblLanguages";

Double columnWidth = StiAlignValue.AlignToMinGrid(Rapport.PageTranslations.Width * 50 / 100.0, 0.1, true);
StiText TextBlock = new StiText(new Stimulsoft.Base.Drawing.RectangleD(pos, 0, columnWidth, 0.5f));
TextBlock.Text.Value = @"{tblLanguages.lang_name}";
TextBlock.Brush = new StiSolidBrush(Color.Wheat);

Rapport.BandLanguages.Components.Add(TextBlock);

Rapport.Render(false);
Rapport.Show();


I can see that the column is added to the report but no data is shown.

If I load the report from the mrt file instead of using the csharp generated class all is well.


Is it possible to add columns to a report in a csharp class?


I've just found out that if i manually add an eventhandler for the GetValue event I'm able to get data on my report,
but I would like that to be automatically.

Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Adding columns to a databand at runtime

Post by Vital »

In following line you are use expression:

TextBlock.Text.Value = @"{tblLanguages.lang_name}";

but report already converted to code and this line don't have sense. How to solve this problem?

1. Assign to TextBlock.TextValue ready text value
2. Use GetValue event of Text.


Thank you.

Post Reply