Reputation: 228
I have a JavaScript Variable that is set in my ASP.NET page as follows
<script type="text/javascript>
var MyVarable = <%=ASPNETVarable%>;
$(document).ready(function () {
alert(MyVarable);
}
</script>
Now this is simplified and on the back end code ASPNETVarable is set as
protected string ASPNETVarable="My Backend Value";
The page loads & runs correctly, but in Visual Studio the line
var MyVarable = <%=ASPNETVarable%>;
Shows that it's a "Syntax error", while it works, how do I remove this "syntax error" ?
Upvotes: 1
Views: 1051