Am I doing something wrong is this a known issue with the ASP.NET MVC beta?
<%@ Page Title='' Language='C#' MasterPageFile='~/Views/Shared/Site.Master' AutoEventWireup='true' CodeBehind='Index.aspx.cs' Inherits='MyProject.Web.Views.Searching.Index' %> <asp:Content ID='Content1' ContentPlaceHolderID='MainContent' runat='server'> <%Html.BeginForm('SearchForBusiness', 'BusinessSearch', FormMethod.Post); %> <select id='myid' name='myid'> <%foreach (MyProject.DomainModel.DomainModelCategory.Category cat in ViewData.Model) %> <%{ %> <option value='<%=cat.Id %>'><%=cat.CategoryName %></option> <%} %> </select> <input type='submit' value='search' /> <%Html.EndForm(); %> </asp:Content>
The trouble I’m having (and really it’s just an annoyance) is on the OPTION line…cat.Id does not have intellisense enabled but cat.CategoryName does…
I know it’s still Beta but I was wondering if anyone knew the status of this…
Thanks!
Unfortunately, Intellisense doesn’t work inside HTML attributes. I’m not sure why, it just doesn’t.
When I really need Intellisense for an attribute value, I write the server-side code outside the attribute first, then cut-paste it in. For example, I’d write this:
Then cut-paste to make it look like this
It’s a workaround, but it works.
This is an issue with the ASP.Net designer in general, so it’s not isolated to MVC (it also occurs in WebForms). The issue is just a bit more prominent now that more people are using the ‘<%= %>’ tags to build HTML (thanks to MVC).