3

In this .aspx file I am getting a warning saying "Unterminated string constant". I've looked into the error and found that it means there is an open single or double quote somewhere. However, I do not have an open single or double quote, but it is still throwing the warning. Why?

The warning underlines the bolded portion below. Notice the bolded single quote at the end.

onclick="window.location='pagename.aspx?aid=<%=VariableName%>'">

<input type="button" name="buttonCancel" class="btn btn-warning btn-sm" value="Cancel" onclick="window.location='pagename.aspx?aid=<%=VariableName%>'">

3 Answers 3

1

Yeah pretty painful. I think it has to do with parsing priority.

Here's another way to write it that won't throw the error.

<input type="button" onclick="<%="window.location=PageName.aspx?aid=" + VariableName%>"/>
0

<%=VariableName%> could contain a single/double quote.

Try remove <%=VariableName%> and see if it work.

3
  • Even if it contained a single quote inside VariableName that would cause the JS to blow up, not the ASP.NET Web Forms compilation.
    – mason
    Jul 22, 2016 at 19:19
  • VariableName does not have any single or double quotes. Jul 22, 2016 at 20:01
  • Could it simply be that onclick is html, thus the compiler is only expecting html inside of it, so when it sees <%VariableName%> it just doesn't know what to do? Jul 22, 2016 at 21:21
0

Fot me this was in visual studio C++ Unreal engine project and I was missing

["]

at the end of #include file name hope this helps someone

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.