I am writing in Visual Studio 2012 (Visual Basic) ASP.NET MVC4 project.
Here is my piece of code:
<input type="button" value="EDIT" onclick="MngMCRItem('@Url.Action("EditMCRItem", "MCRForm", Nothing)', {doc_id : '@Model.DOC_ID', item_id : @itm.ITEM_ID_IN_DOC}, this.value)"/>
This code causes the editor show error
Unterminated string constant. Expected ')'.
Are there any better way to rewrite my code? Thank you in advance for every advice.
EDIT
Currently, I have Resharper 8.2.1 with Visual Studio 2013 the problem has gone.
You have a problem with double quotes and single quotes here:
onclick="MngMCRItem('@Url.Action("EditMCRItem", "MCRForm", Nothing)'
You open double quote here -> "MngMCRItem('@Url.Action("
<- here it's closed so the next part of the command can not be understood...
@Alex Art, did you try putting my snippet into the Visual Studio editor and see what is going on? From that context, I am confident that I did NOT make the mistake. So, I will provide the clearer snippet below and I think this is easily obvious.
@Code
Dim testing As String = "Hello World!"
End Code
<script type="text/javascript">
var test = {
foo : '@Html.Hidden("helloWorld", testing)', // This is perfectly OK
bar : 'testing'
};
</script>
<input type="text" name="inpTesting" value="test" onclick="alert('@testing');" /> <!--ERROR in inline js-->
<input type="text" name="inpTesting" value="" onclick="alert('Hello World!');" /> <!--Server-Compiled(result) Code when using some browser 'view page source'-->
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.