Intellisense is throwing this error when I try to implement an Html.ActionLink in my Index View:
"System.Web.Mvc.HtmlHelper>'does not contain a definition for 'ActionLink' and the best extension method overload 'System.Web.Mvc.Html.LinkExtensions.ActionLink(System.Web.Mvc.HtmlHelper, string, string,string)' has some invalid arguments"
I have verified I have the correct references and checked my web.config file within the views folder and have what appears to be the correct namespaces, below is the namespaces within that web.config
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
Here is my Index.cshtml
@model IEnumerable<Madison_TestApp.Models.Notes>
@using Madison_TestApp.Models;
@{
ViewBag.Title = "Notes List";
}
<h2>Notes List</h2>
<ul>
@foreach(Notes note in @Model)
{
<li>
***@Html.ActionLink(note.ProductID, "Details", new { id = note.ID })***
</li>
}
</ul>
Here is my Controller Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Madison_TestApp.Models;
using System.Web.Mvc.Html;
namespace Madison_TestApp.Controllers
{
public class NotesController : Controller
{
public ActionResult Index()
{
NotesContext notesContext = new NotesContext();
List<Notes> notes = notesContext.Notes.ToList();
return View(notes);
}
public ActionResult Details(int id)
{
NotesContext notesContext = new NotesContext();
Notes note = notesContext.Notes.Single(prodnote => prodnote.ID == id);
return View(note);
}
}
}
And Here is my model code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc.Html;
namespace Madison_TestApp.Models
{
[Table("ProductNotes")]
public class Notes
{
public int ID { get; set; }
public int ProductID { get; set; }
public string NoteText { get; set; }
public DateTime CreateDate { get; set; }
public bool Archived { get; set; }
}
}