ASP.NET MVC markup in VS2008 script has warnings with "expected expression",

I was looking for SO and could not find this question before, but I cannot believe that I am the only one who works with it. If this is a duplicate, please give me an original question.

In VS2008, I have ASP.NET MVC markup in the script section on some of my pages. I end up getting the “expected expression” warning when marking up ASP.NET MVC, even if jQuery / JavaScript in the previous code is valid. This only happens when marking up.

This does not interfere with the rendering of the page, everything works fine. This is more annoying than anything else. I installed VS2k8 SP1 along with the Intellisense fix, and this is still happening. This also happens if I run R # 4.5 or 5.0 EAP.

Suggestions or should I just choose my battles when it comes to VS 2008?

Screenshot: My apologies, I could have sworn I added a screenshot to this question.

http://www.twitpic.com/z6bxj

+4
source share
1 answer

VS constructor is not suitable for handling cases when your markup jumps between the server and client side of the script.
Sometimes adding <%=""%> at the top helps, according to this post: http://forums.asp.net/t/1384577.aspx . The VS constructor also seems slow to pick up changes, reassemble and remove errors.

In your case, I think it is trying to parse this line as Javascript, but that is clearly not the case. If you get rid of error removal, you will have to refactor the code, for example, generate the entire JS script as a server line and write it.

I learned to deal with errors as soon as tips, and as soon as the page is stable and working, just ignore them.

+3
source

Source: https://habr.com/ru/post/1299078/


All Articles