jquery - Why is Ajax.ActionLink updating entire page instead of just UpdateTarget -
this should replace updatetarget, not, replaces entire page , don't see why. correct partial view being returned, instead of replacing target id, replacing entire page.
<div id="magheader"> <p>this test.</p> @ajax.actionlink("edit", "geteditor", "home", new ajaxoptions(){ updatetargetid = "magheader", insertionmode = insertionmode.replace}) </div>
at runtime, link looks this:
<a href="/home/geteditor" data-ajax-update="#magheader" data-ajax-mode="replace" data-ajax="true">edit</a>
is there doing wrong? have done in past no issues.
edit underlying reason issue in vs 2012, needed add reference jqueryval bundle make work. however, in 2013, bundleconfig.cs changed jqueryval bundle no longer includes jquery.unobtrusive. simple fix add bundle:
bundles.add(new scriptbundle("~/bundles/jqueryval").include( "~/scripts/jquery.unobtrusive*", "~/scripts/jquery.validate*"));
then work expected.
check if loading @scripts.render("~/bundles/jqueryval")
page somewhere or not. because unobtrusive javascript file not getting loaded. check video
edit:
please check if there packages installed in packages.config file.
<package id="microsoft.jquery.unobtrusive.ajax" version="3.1.1" targetframework="net451" /> <package id="microsoft.jquery.unobtrusive.validation" version="3.0.0" targetframework="net451" />
Comments
Post a Comment