Part 92 Ajax with asp net mvc

kudvenkat · 274K views · 2013 · 19:09

Open on YouTube

Web developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering or referencing how to do Ajax calls and partial view updates in ASP.NET MVC.

Recommended by 2 people across 2 different months, 2014 to 2020.

What it is

Part 92 of kudvenkat's ASP.NET MVC tutorial series shows how to use the Ajax.ActionLink helper to do partial page updates. The demo builds an app that loads all students, the top 3 or the bottom 3 into a partial view depending on which link is clicked, using an Entity Framework model and a _Student.cshtml partial.

What people said

Recommends Willian Andrade · 2015-02 · Stack Overflow · on “javascript or ajax to update database with asp.net mvc?”

Looks like you using asp.net mvc. You can write your ajax calls with pure javascript Ajax docs [LINK] or the easiest way, using JQuery [LINK] . You need to add one action on your controller to receive the ajax data, and then insert/update your db. See this [LINK] , this [LINK] and this [this video] .

Recommends C Murphy · 2020-02 · Stack Overflow · on “Send and receive data through jQuery ajax and update database in Entity Framework in ASP.NET MVC”

If I am understanding your request, then an easy way to do this would be to utilize the Microsoft jQuery Unobtrusive Ajax Nuget Package. Using this, you could set up your dropdowns within the Ajax submit form and have the submission update a targeted DIV id with new data from a partial view. to do so, you would need to install it via the Nuget Package Manager and enter the following in your view: @{using (Ajax.BeginForm("Metadata", "Applications", null, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "DivID", InsertionMode = InsertionMode.Replace, // ... })) { // Html Code (DropdownList) Here (within form) }} // At the end of your view: <script src="~/Scripts/jquery.unobtrusive-ajax.

Cites Warlock · 2014-10 · Stack Overflow · on “Failed to load resource: the server responded with a status of 404 (Not Found)”

Im using Contoso university tutorial and Im trying to modify it by this tutorial: [this video] When Im done it I see this error in browser inspector (F12) [LINK] Failed to load resource: the server responded with a status of 404 (Not Found) Could somebody explain where is the problem? Controller: public PartialViewResult Top3() { List<Student> model = Students.OrderByDescending(s => s.Enrollments.Select(s => s.Course.Credits)).Take(3).ToList(); return 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"><