I have a function in C# which can be called like this:
string result = CachedLanguageItems.GetLabel("RandomLabel").Value
It returns me the cached value of the RandomLabel.
Now I want to use this method in Javascript like this:
var result = <%= CachedLanguageItems.GetLabel("RandomLabel").Value %>
This is also working. It returns me the cached value of RandomLabel.
The problem that I am facing now is, that I am not able to pass a javascript variable to the method instead of a hard coded string. e.g.:
var javascriptVariable= "RandomLabel"
var result = <%= CachedLanguageItems.GetLabel(javascriptVariable).Value %>
Can somebody tell me how to pass the javascript variable correctly to the embedded c# call of the method?
Do I have to escape the embedded code for this?
Is this even possible?
Thanks for the help.