asp.net mvc - How can I ajax load new pages/views into MainContent when using a master page -


HTML to load subpage in main content. Instead of using thennlink, I would like to load them with AJAX. For example (taken from Site.Master):

  • & lt;% = Ajax.exeLink ("Home", "Index", "Home", New Application () {UpdateTargetId = "Main"})% >
  • & lt;% = Ajax.AccellLink ("About me", "index", "about", new Ajax option () {UpdateTargetId = "main"})%>
  • & lt;% = Ajax.ActionLink ("see my work", "index", "work", new Ajax option () {UpdateTargetId = "main"})%>
  • & lt ;% = Ajax.exeLink ("Services", "Index", "Services", New Ajax Option () {UpdateTargetId = "main"})%>
  • & lt;% = Ajax.AccellLink ("Contact", "Index", "Contact", New Ajax Option () {UpdateTargetId = "main"})%>
  • This works, but when I link that link I click on any one that loads the master page again.

    Click on a link and see what happens. How to solve any ideas?

    You have to create a different view of the index, which does not inherit, from the same master page Remove MasterPageFile by the way, or use a different master page.

    However, this is probably not a good design, because you will have problems with search engines, which will not be able to properly index your website. The only thing for those people who want to bookmark or link an internal page.


    Comments