|
Conditional panel is a very special element that helps us to store different content for the same area on the page and define preconditions (XSL Expressions) for displaying them at the runtime.
Suppose we have an area in a page whose content will be different depending on the login status of the user. If the user is not logged in yet he will be displayed a form and input fields in it to allow him to login. After he logs on, the form and the input fields will disappear and the user will be displayed with another content.
Steps:
| 1. | Prepare an XML file with the content below and save it as "c:\xml\login.xml". |
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Login>
<Status>LoggedIn</Status>
<UserName>John Doe</UserName>
</Login>
</root>
|
| 2. | Create a new page in your project |
| 3. | Set its "XML file for Preview" property to "c:\xml\login.xml" |
| 4. | Insert a condition panel into the page.
The exclamation mark in the elements signals that no conditions are yet defined. |

We will create two conditions in the condition panel; one will be displayed to the users which not yet logged in and the second to the users which already logged. After we finish the our work the elements of the Conditional panel will be similar to the following.

| 5. | Double click onto the condition panel area to call the Conditions dialog. Add two new conditions using button. |
| 6. | Name the conditions as "LoggedIn" and "NotLoggedIn". Now, we can select the panel of each condition by double-clicking on the conditions in the dialog. |
| 7. | Select the "NotLoggedIn" condition and add three text and two editbox elements into it and assign values as follows. |
Condition: NotLoggedIn

| 8. | Select the "LoggedIn" condition and add three text elements into it and assign values as follows. |
Condition: LoggedIn

| 9. | Press F9 to preview. To test the other condition, change the value of the <Status> tag in XML file and press F9 in Application Studio again. |
|