Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC Intellisense not finding ViewData

Tags:

asp.net-mvc

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.

like image 885
RedWolves Avatar asked Oct 15 '22 17:10

RedWolves


1 Answers

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

like image 96
thaBadDawg Avatar answered Oct 18 '22 14:10

thaBadDawg