This is fairly simple:

<!-- TemplateBeginIf cond="Component.Key=='TrackingTag'" -->
 . . .
<!-- TemplateEndIf -->

However, I'm stuck with reverse condition. For example in C# we usually do:

if(!String.IsNullOrEmpty()) // 

So I want the Equivalent in DWT :

This was tried but Not working. condition !(Component.Key=='TrackingTag') always comes true.

<!-- TemplateBeginIf cond="!(Component.Key=='TrackingTag')" -->
  • What does @@Component.Key@@ show in your second scenario? Commented Aug 16, 2013 at 10:44

3 Answers 3


Try this way

<!-- TemplateBeginIf cond="Component.Key != 'TrackingTag'" -->

Siva answered how you check for inequality, but I'll chime in how to check for existence.

The equivalent of String.IsNullOrEmpty(Component.Key) would probably be

<!-- TemplateBeginIf cond="Component.Key" -->

This condition will only pass if Component.Key exists and it has a value.

People often use that construct to ensure that a field exists/has a value, before they write the wrapper tags:

<!-- TemplateBeginIf cond="Component.Subtitle" -->
<!-- TemplateEndIf -->
  • ok. But i need the reverse. if something doesn't exists, i need to include the lines inside. So: <!-- TemplateBeginIf cond="!Component.Subtitle" --> will work ?
    – R.C
    Commented Aug 16, 2013 at 8:02
  • 1
    !Component.Key works to show markup for me when the field is empty. But if your schema allows multiple Key values, you may want a loop in addition to checking individual fields. Commented Aug 16, 2013 at 10:41

Do not need to use "==" for string operand, try like below,

<!-- TemplateBeginIf cond="Component.Key='TrackingTag'" -->
 . . .
<!-- TemplateEndIf -->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.