Switch, Case and EndSwitch Tag Reference

Switch, Case and EndSwitch Tags are used when you wish to test for multiple different conditions, and manipulate your output depending on which condition is met. 

In theory the same thing can be done with If, ElseIf and EndIf Tags, but testing multiple conditions using those Tags can quickly become complicated and error prone. Switch, Case and EndSwitch Tags are a simpler alternative to use in this situation.

Switch Tags are used to begin a list of Case Tags, and EndSwitch Tags are used to end that list. Each Switch Tag must have a corresponding EndSwitch Tag.

Each Case Tag evaluates a different condition, and the Tags, text, etc., after the first condition that is met, and before the next Case Tag, are executed or displayed. If the last Case Tag's condition is met, then the Tags, text, etc., before the EndSwitch Tag are executed or displayed. If multiple Case Tag conditions are met, only the first Case Tag is executed (with the exception of the defaultCase property below).

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.