tags:

views:

466

answers:

2

I am trying to go through the following tutorial on asp.net. When I get down to this code:

    <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="MvcApplication1.Views.Home.Index" %> 
<%@ Import Namespace="MvcApplication1.Models" %> 
<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server"> 
<table> 
<tr>      
<th>Id</th>
<th>Title</th>
<th>Release Date</th> 
</tr> 
<% foreach (Movie m in (IEnumerable)ViewData.Model) { %> 
<tr>      
      <td><%= m.Id %></td>
      <td><%= Html.Encode(m.Title) %></td>
      <td><%= m.DateReleased %></td>
 </tr>
 <% } %>
 </table>
 </asp:Content>

When I type in ViewData it doesn't show in intellisense as if I am not including a reference or something. Also further down Html.Encode Html doesn't show in intellisense. What am I doing wrong?

I am using the latest version of MVC.

+4  A: 

Try doing a Build on your MVC project. Until the code behind has been compiled for the first time the intellisense won't work.

thaBadDawg
The Release Candidate has a solution to this with the code-behind-less strongly typed views.
Haacked
A: 

The best way I've found to force this to work is to Save the file, build close the file and reopen it... works 95% of the time for me. This is a known issue and has been fixed in the RC of ASP.NET MVC.

Chad Moran