Answer the question
In order to leave comments, you need to log in
How to implement ASP.NET Core Ajax delete?
The essence of the task is this - it is necessary to implement deletion on ASP.net core without reloading the page using Ajax. Ajax tags, unfortunately, do not work in core. And if possible, then the implementation with a minimum of javascript code is better.
Here is the code from the view:
<a data-ajax="true" data-ajax-mode="replace" data-ajax-update="#results" href="/Project/[email protected]">Удалить</a>
public ActionResult Delete(int? id)
{
Project project = _context.Project.Find(id);
_context.Project.Remove(project);
_context.SaveChanges();
return PartialView("newList");
}
Answer the question
In order to leave comments, you need to log in
Look at courses like this - https://codewithmosh.teachable.com/p/asp-net-core/...
This course (3 pcs.) is just super - https://programmingwithmosh.com/become-a- full-stac...
After studying it, you will learn a lot of new things.
It’s better to immediately learn how to do small projects right from and to, then it’s easier on your own.
To avoid writing Delete(int? id) and the like (this method is useless with a null argument, it sounds like "delete nothing").
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question