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

Conditional formatting of Data

3 Answers 326 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rahul Khinvasara
Top achievements
Rank 1
Rahul Khinvasara asked on 01 Dec 2007, 10:28 AM
Hi,
     I am creating a report application where I want to make conditional formatting. I have a column as status . The column contains data ' normal status'  and 'abnormal status'. The column is showing data correctly.
 Now what I needed is to show the data 'abnormal status' as bold.
     Thus, I don't want the complete column to be bold. Depending upon the data it contains I want the selected data to be bold from that column.
   Is it possible to do so?

Thanks,
Rahul

3 Answers, 1 is accepted

Sort by
0
Milen | Product Manager @DX
Telerik team
answered on 03 Dec 2007, 05:51 PM
Hello Rahul,

Thank you for contacting us again.

In order to accomplish your goal, you may use the Conditional Formatting property of report items. This technique gives you the power to apply formatting on a report item only if a condition is met.

In your case the condition can be

=Fields.Status = ="abnormal status"
.

This line compares if the two expressions evaluate to equal values during processing. If the values are equal, the chosen Style is applied. In your case in the Style only check the Bold check box.

If you want only the TextBox with the Status field to turn bold, apply conditional formatting on it only, otherwise apply it on the desired textboxes.
If you want for example to apply the formatting on all texboxes in a section, you can apply the formatting on the section reporting item. In that case be careful if you have set global styles, because they matter more then the parent style (the section is parent to the textboxes in it).

In the attached report library project you can review example of conditional formatting used.

I hope this information helps.



Sincerely yours,
Milen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rahul Khinvasara
Top achievements
Rank 1
answered on 04 Dec 2007, 07:21 AM
Hi!,
     I am creating the textbox dynamically(code provided by you) as:

Private Function CreateTxtDetail(ByVal FieldName As String, ByVal i As Integer) As Telerik.Reporting.TextBox
        Dim txtHead As New Telerik.Reporting.TextBox()
        txtHead.Value = "=[" + FieldName + "]"
        txtHead.Location = New Telerik.Reporting.Drawing.PointU(New Telerik.Reporting.Drawing.Unit(i, Telerik.Reporting.Drawing.UnitType.Inch), New Telerik.Reporting.Drawing.Unit(0, Telerik.Reporting.Drawing.UnitType.Inch))
            txtHead.Size = New SizeU(New Unit(2, Telerik.Reporting.Drawing.UnitType.Cm), New Telerik.Reporting.Drawing.Unit(1, Telerik.Reporting.Drawing.UnitType.Cm))
     Return txtHead
End function

In this scenario how to write code for conditional formatting?Can you please help me?

Thanks,
Rahul






0
Svetoslav
Telerik team
answered on 04 Dec 2007, 04:48 PM
Hello Rahul,

As far as the Telerik Reports are .NET classes there is no difference whether you will use the designer to generate it or code it by yourself. The best place you can look for sample code is to first use the Report designer to create a report and then examine the designer generated class (usually named with .designer.cs for C# or .designer.vb for VB.NET).

Best wishes,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Rahul Khinvasara
Top achievements
Rank 1
Answers by
Milen | Product Manager @DX
Telerik team
Rahul Khinvasara
Top achievements
Rank 1
Svetoslav
Telerik team
Share this question
or