jquery - Failed to load resource: the server responded with a status of 404 (Not Found) -
im using contoso university tutorial , im trying modify tutorial:
https://www.youtube.com/watch?v=b59skvlroyc
when im done see error in browser inspector (f12)
https://www.dropbox.com/s/wy1c6ocxxbke1f2/error.jpg?dl=0
failed load resource: server responded status of 404 (not found)
could explain problem?
controller:
public partialviewresult top3() { list<student> model = students.orderbydescending(s => s.enrollments.select(s => s.course.credits)).take(3).tolist(); homecoming partialview("_student", model); }
index view:
@model pagedlist.ipagedlist<contosouniversity.models.student> @using pagedlist.mvc; <link href="~/content/pagedlist.css" rel="stylesheet" type="text/css" /> <script src="../scripts/jquery-1.8.0.min.js"></script> <script src="~/scripts/jquery.unobtrusive-ajax.min.js"></script> @{ viewbag.title = "students"; } <h2>students</h2> <p> @html.actionlink("create new", "create") </p> @using (html.beginform("index", "student", formmethod.get)) { @html.antiforgerytoken() @html.validationsummary(true) <p> find name: @html.textbox("searchstring", viewbag.currentfilter string) enrollment: <input type="submit" value="filter" /> </p> } <table class="table"> <tr> <th> @html.actionlink("last name", "index", new { sortorder = viewbag.namesortparm }) </th> <th> first name </th> <th> @html.actionlink("enrollment date", "index", new { sortorder = viewbag.datesortparm }) </th> <th> date of birth </th> <th> courses </th> <th> credits </th> <th></th> </tr> @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.lastname) </td> <td> @html.displayfor(modelitem => item.firstmidname) </td> <td> @html.displayfor(modelitem => item.enrollmentdate) </td> <td> @html.displayfor(modelitem => item.dateofbirth) </td> <td> @string.join(",", item.enrollments.select(e => e.course.title)) </td> <td> @item.enrollments.sum(e => e.course.credits) </td> <td> @html.actionlink("edit", "edit", new { id=item.id }) | @html.actionlink("details", "details", new { id=item.id }) | @html.actionlink("delete", "delete", new { id=item.id }) </td> </tr> } </table> <br /> @ajax.actionlink("top3", "top3", new ajaxoptions() { httpmethod = "get", updatetargetid = "divstudents", insertionmode = insertionmode.replace }) <span style="color:blue"></span> <div id="divstudents"> </div> page @(model.pagecount < model.pagenumber ? 0 : model.pagenumber) of @model.pagecount @html.pagedlistpager(model, page => url.action("index", new { page, sortorder = viewbag.currentsort, currentfilter = viewbag.currentfilter }))
partial view:
@model ienumerable<contosouniversity.models.student> <h3>top 3 student</h3> <table style="border: 1px solid black; background-color:silver"> @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.lastname) </td> <td> @html.displayfor(modelitem => item.firstmidname) </td> <td> @html.displayfor(modelitem => item.enrollmentdate) </td> <td> @html.displayfor(modelitem => item.dateofbirth) </td> <td> @string.join(",", item.enrollments.select(e => e.course.title)) </td> <td> @item.enrollments.sum(e => e.course.credits) </td> </tr> } </table>
jquery ajax asp.net-mvc-4
No comments:
Post a Comment