I am trying to load a partial view inside of the main view, and a similar question was posted here - ' How can i load Partial view inside the view ' explaining how to use ajax actionlinks, but I still can't seem to get this working without the partial view displaying on a brand new page.
Here is the basis of my code that is in the main view,
<td>
@Ajax.ActionLink(
item.FirstName,
"DisplayApplication",
new { ID = item.PersonID },
new AjaxOptions { UpdateTargetId = "ApplicationByPerson" }
)
</td>
...
<div id="ApplicationByPerson"></div>
Then later down the page I have a Div called "ApplicationByPerson" I want my partial view displayed in.
In my controller I then have the code,
public ActionResult DisplayApplication(int ID)
{
var tmp = db.Persons.Where(x => x.PersonID == ID).Include(y => y.Apps).FirstOrDefault();
return View(tmp.Apps);
}
The right information is being returned to the view, but it is displaying by itself as a new view. I'm sure it is something simple I am doing wrong.