Developer forum

Forum » Development » TagExists for a GlobalValue

TagExists for a GlobalValue

Rui Silva
Reply

Hi,

In a project he created a new Global value that he want to use in some templates using the line:

@GetGlobalValue("WebSeviceConnectionStatus")

In the backend I'm using the Template.TagExists("WebSeviceConnectionStatus") but this always returns false. is there any way to check this on the backend?

Best,

Rui Silva

 

 


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Rui

TagExists looks at the template context - the file it self. If you have a global tag, the tag is global meaning it can be used in all templates. So there is not template context - they are global and not related to any specific template and tag exists will therefore return false. But the tag will only be set once. Since your are using Razor you could add the value to a Helper Method instead, include the helper method where needed and call it when needed.

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum