I have a string in my C# code-behind file in ASP.NET:
string data = "Data that is populated";
//Note: A method populates the actual data
I need to be able to convert this string to a JavaScript var. I know that using a Razor file is a common way to go and there are several questions on this topic, but I am unsure how to do this with a code-behind file, nor have I full understood the previous questions and answers.