It seems that Intellisense just doesn't work within attributes in an ASP.NET page. I really like strong typing, because I like Intellisense, and so I generally make sure to bind to a strongly typed object in ASP.NET:
<Repeater ID="rep" runat="server">
<ItemTemplate>
<div id="mydiv" class="<%# TypedObject.Class %>" runat="server">
<%# TypedObject.Name %>
</div>
</ItemTemplate>
</Repeater>
Intellisense just works within the body of the div, but no matter what I do it will not work to set that class attribute. This is very annoying, since attributes are pretty fundamental in HTML, and many of the built in controls use them heavily.
I can't find anything about this, but I can't believe this isn't a pretty fundamental need. Is there any way to get this to work?
It is really bad that Visual Studio 2008 / 2010 does not handle this. I sincerely hope it will come in the next release. However there are extensions out there that do help here.
Just tried Resharper for this particular reason and found it to be of great help. Both syntax checking and IntelliSense in my attribute strings now :-). I guess there are other Visual Studio extensions that do this aswell, havent tried just yet. (Resharper costs some, but they do have alternative free licenses for academic and open source dev.)
I have same problem very often, even while working in asp.net mvc 2. Usually I just type code outside class (where intellisense works) and then just move that piece of text into attribute. :S
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With