Color on alternating data rows

Stimulsoft Reports.NET discussion
Post Reply
Sandy Pham
Posts: 62
Joined: Mon Dec 11, 2006 1:43 pm
Location: U.S.A.

Color on alternating data rows

Post by Sandy Pham »

I'm trying to create a report that looks like your "Simple List" report in the Demo sample. I can't get it to alternate the row color.

I've added this code to my report:

Stimulsoft.Report.StiStyle Odd = new Stimulsoft.Report.StiStyle();
Odd.Name = "Odd";
Odd.Border = new Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.None,
System.Drawing.Color.Black, 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid,
false, 4, new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black));
Odd.Brush = new Stimulsoft.Base.Drawing.StiSolidBrush(defReportStyle.RowDataBackgroundColor);
Odd.Font = new System.Drawing.Font(defReportStyle.RowDataFontName, defReportStyle.RowDataFontSize);
Odd.TextBrush = new Stimulsoft.Base.Drawing.StiSolidBrush(defReportStyle.RowDataTextColor);
Odd.TextOptions = new Stimulsoft.Base.Drawing.StiTextOptions(false, false, false, 0F,
System.Drawing.Text.HotkeyPrefix.None, System.Drawing.StringTrimming.None);
m_report.Styles.AddRange(new Stimulsoft.Report.StiStyle[] { Odd });
dataBand.OddStyle = "Odd";

All of my data rows have the color. What am I doing wrong?

Help is much appreciated.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Color on alternating data rows

Post by Vital »

Your code is correct, but you need check state of report. If your report not compiled then this code is correct.
If your report is compiled then you need use report.CompiledReport instead report.

Thank you.
Post Reply