title: ASP.NET MVC5 Ajax Partial View loading full page
body: <p>I am using ajax helpers to load data asynchronously, I am using MVC5, EF6 and returning PartialView from controller but partial view is loading on full page instead of updating a DIV asynchronously. Following is my code:</p>
  
  <pre><code>SampleDBContext db = new SampleDBContext();
  public ActionResult Index()
  {
      return View();
  }
  
  // Return all students
  public PartialViewResult All()
  {
      List&lt;Student&gt; model = db.Students.ToList();
      return PartialView("_Student", model);
  }
  </code></pre>
  
  <p>my index.cshtml code is</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta name="viewport" content="width=device-width" /&gt;
      &lt;title&gt;Index&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div style="font-family:Arial"&gt;
  
          &lt;script src="~/Scripts/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
          &lt;script src="~/Scripts/jquery.unobtrusive-ajax.min.js"&gt;&lt;/script&gt;
          &lt;h2&gt;Students&lt;/h2&gt;
  
          @Ajax.ActionLink("All", "All",
      new AjaxOptions
      {
          HttpMethod = "GET", // HttpMethod to use, GET or POST
          UpdateTargetId = "divStudents", // ID of the HTML element to update
          InsertionMode = InsertionMode.Replace // Replace the existing contents
      })
  
          &lt;br /&gt;&lt;br /&gt;
          &lt;div id="divStudents"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Markup of _Student.cshtml Partial view is:</p>
  
  <pre><code>@model IEnumerable&lt;GS.MVC_Ajax_Venkat3.Models.Student&gt;
  &lt;table class="table" style="border:1px solid black; background-color:greenyellow"&gt;
      &lt;tr&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Name)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.TotalMarks)
          &lt;/th&gt;
      &lt;/tr&gt;
  
      @foreach (var item in Model)
      {
          &lt;tr&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.Name)
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.TotalMarks)
              &lt;/td&gt;
          &lt;/tr&gt;
      }
  &lt;/table&gt;
  </code></pre>
  
  <p>I have added Keys to web config also as follows</p>
  
  <p>
  </p>