I am building my ASP server control which has some resources. One of them is .js file where i must pass a variable from my ServerControl.cs file.
I know how to for example get resource images in my resource style files and javascript files like this:
var resourceOpen = "<%=WebResource("PatientList.Images.DirOpen.png")%>" ;
var resourceClose = "<%=WebResource("PatientList.Images.DirClose.png")%>";
background: url('<%=WebResource("PatientList.Images.letter-bg.png")%>');
I want to do the same with my public variables in my server control .cs file Let's say i've got
public string TestVariable = "It works"
How to pass it to javascript file in my resources?
var jsvariable = "<%=TestVariable%>"
Doesn't work. It seems that only WebResource(...) works. When i try to use variables, when I make something like this:
alert("<%=TestVariable%>");
The window with string "<%=TestVariable%>" will appear instead of "It works"