Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Intellisense doesn't work in attributes

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?

like image 594
Joshua Frank Avatar asked May 25 '10 13:05

Joshua Frank


2 Answers

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.)

like image 181
joeriks Avatar answered Nov 09 '22 09:11

joeriks


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

like image 24
Goran Obradovic Avatar answered Nov 09 '22 08:11

Goran Obradovic