c# - ajax actionlink redirecting instead of updating tag -
when making ajax call controller redirecting , not updating tags code looks follows.
this in _layout.cshtml
<code> <script src="@url.content("~/scripts/jquery-1.4.1.min.js")" type="text/javascript"> </script> <script src="@url.content("~/scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script> <script src="@url.content("~/scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@url.content("~/scripts/microsoftajax.js")" type="text/javascript"> </script> <script src="@url.content("~/scripts/microsoftmvcajax.js")" type="text/javascript"> </script> </code>
and web config looks like, have tried turning off unobtrusive javascript off no luck.
<code> <appsettings> <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> </appsettings> </code>
my controller method looks this
<code> [httppost] public actionresult create(lesson lesson) { if (modelstate.isvalid) { //save album lesson.datecreated = datetime.now; lesson.datesubmitted = datetime.now; lesson.statusid = submitted; lesson.submittedbyuserid = getappuserid(); lesson.prjlessonid = createlessonprjid(lesson.projectid); storedb.lessons.insertonsubmit(lesson); storedb.submitchanges(); return redirecttoaction("index"); } // invalid – redisplay errors else return view(lesson); } </code>
any ideas? in advance.
<code> @if (item.statusid != null) { <td id ="approvedmsg">@item.getlessonstatus(item.statusid.value)</td> } else { <td> </td> } @if (item.statusid != 3) { <td> @html.actionlink("edit", "edit", new { id = item.lessonid }) | @ajax.actionlink("delete", "delete", new { id = item.lessonid }, new ajaxoptions { updatetargetid = "approvedmsg"}) </td> } </code>
try deleting microsoftajax.js
, microsoftmvcajax.js
, use
<script src="<%=url.content("~/scripts/jquery-1.4.1.min.js")%>" type="text/javascript"></script> <script src="<%=url.content("~/scripts/jquery.validate.min.js")%>" type="text/javascript"></script> <script src="<%=url.content("~/scripts/jquery.unobtrusive-ajax.min.js")%>" type="text/javascript"></script> <script src="<%=url.content("~/scripts/jquery.validate.unobtrusive.min.js")%>" type="text/javascript"></script>
a post here http://yobriefcase.posterous.com/unobtrusive-javascript-in-mvc3
Comments
Post a Comment