views:

417

answers:

1

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!

+6  A: 

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:

<%=cat.Id %>    
<option value=""><%=cat.CategoryName %></option>

Then cut-paste to make it look like this

<option value="<%=cat.Id %>"><%=cat.CategoryName %></option>

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

anurse
What a bummer...work-a-round isn't painful to be sure...but unfortunate.
Webjedi
Yeah, I heard this was supposed to be fixed in VS 2008 SP1, but I'm pretty sure I still encounter it. Do upgrade to SP1 though (if you haven't already), because that _might_ fix your problem
anurse
Thanks for this, glad I checked this out, was confusing me greatly!
optician