5

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.

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

The Release Candidate has a solution to this with the code-behind-less strongly typed views.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.