How can I ajax load new pages/views into MainContent when using a master page

Posted by antevirus on Stack Overflow See other posts from Stack Overflow or by antevirus
Published on 2010-05-17T12:21:31Z Indexed on 2010/05/17 13:00 UTC
Read the original article Hit count: 201

Hello.

Instead of using Html.ActionLink to load subpages into MainContent, I would like to load them with ajax.

For example (taken from Site.Master):

  • <%= Ajax.ActionLink("HOME", "Index", "Home", new AjaxOptions() { UpdateTargetId = "main" })%>
  • <%= Ajax.ActionLink("ABOUT ME", "Index", "About", new AjaxOptions() { UpdateTargetId = "main" })%>
  • <%= Ajax.ActionLink("VIEW MY WORK", "Index", "Work", new AjaxOptions() { UpdateTargetId = "main" })%>
  • <%= Ajax.ActionLink("SERVICES", "Index", "Services", new AjaxOptions() { UpdateTargetId = "main" })%>
  • <%= Ajax.ActionLink("CONTACT", "Index", "Contact", new AjaxOptions() { UpdateTargetId = "main" })%>
  • This works, but when i click one of the links it seems to load the master page all over again.

    http://emma.jabit.se

    Click a link and see what happens. Any ideas how to solve this?

    © Stack Overflow or respective owner

    Related posts about asp.net-mvc

    Related posts about mvc