This is just a shortcoming in the Visual Studio HTML designer component. If you pull the code block outside of the attribute it works great, once you put <%= %>
in the attribute it no longer gives you proper IntelliSense in that block. I've even had this within a style="<%= %>"
attribute go totally haywire and won't even get the syntax color correct (tries to parse it as CSS).
My theory is that the parser is in the context of that tag and attribute so it is trying to interpret what you are doing as values of that attribute. For instance, when you type the open quote of the type="
it knows to show you a list of common values for that tag. If you try to invoke IntelliSense in the middle of type="<%= %>"
, it will show you that same list of values which is not what you would expect in this code block context.
I experience this same exact issue when using the Visual Studio syntax coloring for editing JBST client-side templates. The markup is identical but the syntax coloring freaks out every so often.
I'm betting that there isn't a fix for it as it is pretty core to the designer. Best bet is to wait for a future release. I haven't tried this in Visual Studio 2010 to see if they've fixed it.