This is a migrated thread and some comments may be shown as answers.

Conditional Formatting and PageNumber

3 Answers 342 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark DeMichele
Top achievements
Rank 1
Mark DeMichele asked on 27 Oct 2009, 11:54 PM
Hi there,

I'm trying to format a particular textbox on the first and subsequent pages differently. Specifically, on page 1, I'd like to format the textbox as centered, bold Cambria font, size 14. On pages 2 and up, I'd like to format it as center, bold Cambria, size 10.

The rules I've entered for the textbox are
= PageNumber > =1 ------- center, bold, Cambria, 10
= PageNumber = 1   ------- center, bold, Cambria, 14

Unfortunately, regardless of page number, the textbox is always formatted according to the second rule.

Notably, if the second rule is removed, the textbox is formatted properly.

I also tried formatting the textbox first as size 14, then adding conditional formatting with the first rule only, but that doesn't work. I assume that's expected behavior because as governed by another post, conditional formatting is designed to only change default behavior.

I've already tried switching the order and different combinations of the "Stop If True" setting.

Any ideas of what I'm doing wrong?

Thanks,
Mark

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 28 Oct 2009, 06:08 PM
Hi Mark,

Size 10 is the default font size of the item and it is not taken into account. Only changes to properties different than the default ones are applied and this is the whole point of using a conditional formatting.
For your scenario, you can set the desired style of the textbox to center, bold, Cambria, 10 from the report designer and apply a single conditional formatting rule for when the PageNumber=1.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Mark DeMichele
Top achievements
Rank 1
answered on 29 Oct 2009, 03:38 AM
Hi Steve,

I just tried that, and it didn't work.

As a test, I created a new textbox with Cambria, 10pt, centered, bold text, then created a rule with the condition =PageNumber = 1 and style with font size 14 pt. I left the value of the textbox as the default textBox2 (the actual textbox I'm using had a ReportParameter value in it). When the report is viewed, all the text appears in 14pt font (though in Cambria, centered, and bolded as expected).

The generated source looks ok to me:

            formattingRule3.Filters.AddRange(new Telerik.Reporting.Data.Filter[] { 
            new Telerik.Reporting.Data.Filter("= PageNumber", Telerik.Reporting.Data.FilterOperator.Equal, "=1")}); 
            formattingRule3.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(14, Telerik.Reporting.Drawing.UnitType.Point); 
            this.textBox2.ConditionalFormatting.AddRange(new Telerik.Reporting.Drawing.FormattingRule[] { 
            formattingRule3}); 
            this.textBox2.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.800000011920929, Telerik.Reporting.Drawing.UnitType.Inch)); 
            this.textBox2.Name = "textBox2"
            this.textBox2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(6.9999213218688965, Telerik.Reporting.Drawing.UnitType.Inch), new Telerik.Reporting.Drawing.Unit(0.19999997317790985, Telerik.Reporting.Drawing.UnitType.Inch)); 
            this.textBox2.Style.Font.Bold = true
            this.textBox2.Style.Font.Name = "Cambria"
            this.textBox2.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center; 
            this.textBox2.Value = "textBox2"

Am I doing something else wrong?

Thanks,
Mark

0
Steve
Telerik team
answered on 03 Nov 2009, 09:18 AM
Hello Mark,

After further tests we confirm that there is a problem and we would address it for the upcoming Q3 release this week.

Please excuse us for the temporary inconvenience. Your Telerik points have been updated for bringing this to our attention.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Mark DeMichele
Top achievements
Rank 1
Answers by
Steve
Telerik team
Mark DeMichele
Top achievements
Rank 1
Share this question
or