Background
With ActiveReportsJS, there are multiple ways to change a control's properties. Controls can be programmatically changed while using the API, designed within our Standalone Report Designer, or conditionally created using the expression editor. For this tutorial, we will walk through the required steps to conditionally format a textbox's background color property through the expression editor.
Steps to Complete
- To start, open the Standalone Report Designer.
- Add a textbox to the report's surface. Double click it and type test.
- Click on the textbox control again, and on the right side of the designer, select the Properties tab. Scroll down to find the Color property under Background, and click on the gray button that on the right-hand side to select Expression.
- Within the expression editor, type the following code to only make the textbox visible when TextBox1's value is equal to 'test':
{IIF(#TextBox1 = "test", "Green", "Red")}
- Exit the expression editor and click Preview in the top-left corner of the designer to see the textbox's background color has changed to green.
Tags:
Christian Wirt