Is there a way to retain HTML/ASP.net syntax highlighting and code completion within JavaScript HTML templates inside of razor views?
To help highlight (pun intended) the problem see this image of the problem:
Edit: This questions relates to Visual Studio 2010.
It's the "same" solution for WebForms (via here)
(even though the question references MVC/Razor, I got here looking for WebForms)
Helper
In your code-behind
.aspx.cs
Usage
In your
.aspx
file:Create a helper for it, as shown on Syntax highlighting for script tags with html templates in Visual Studio 2010 MVC3 applications.
Taking the code from there, here are the essentials of what is at that link.
First, add some code to your
HtmlHelperExtensions
:Now you can use it like an
Html.BeginForm()
:Voila! Syntax highlighting by hiding the relevant parts from Visual Studio.