ASP NET Core delete confirmation

preview_player
Показать описание
How to display DELETE confirmation in ASP.NET Core.

Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.

We will discuss the following two types of confirmation when the DELETE button is clicked.

Display Yes or No Delete buttons, when the Delete button is clicked.

Text version of the video

Slides

ASP.NET Core Text Articles & Slides

ASP.NET Core Tutorial

Angular, JavaScript, jQuery, Dot Net & SQL Playlists
Рекомендации по теме
Комментарии
Автор

For people wanting to avoid the refresh page "snap to top effect" due to the href="#", switch the anchor (<a>) element with a span <span> element and remove the href =# altogether.

martink
Автор

Definitely this is a more elegant way to display and handle the confirmation, I believe is more intuitive. Many thanks and live long and prosper (from Spock in Star Trek)

rayt
Автор

Thanks for your precious informations, an amazing solutions.

mosabalsherawy
Автор

Thanks a lot! You are the best .NET tutor I have seen so far in Youtube!

fahmifarhat
Автор

Venkat not only show you the code but what the best practices are...

naodagere
Автор

You're awesome sir. please make some series about extract to pdf, doc, excel, and other files by using itextsharper or Rotativa. thank you.

gaganmudvari
Автор

Hi Venkat, thanks for the great tutorial. I have a question about implementing inline confirmation. If the user is at the very bottom of the page, when you click the 'delete' button, the page automatically scrolls up and you are required to scroll down to see the inline confirmation. Is there a way to prevent this default scroll up action?

senolkurt
Автор

I managed to use this tutorial with a few changes (namely not needing the javascript) to work with a Bootstrap modal.

jayzo
Автор

Nice Video instead of setting unique id for each set of Delete span if we encapsulate them in one div and send that div as parameter to confirm function then it will works just Code review Adiction :P

nh--
Автор

Hello, i really love your tutorials ! I made huge progresses with them :)


One question regarding this one, when i've got more than 5 users in the list and i want to delete it, my page refresh due to the href="#", i'm back at the top of my screen.
Is there a way to keep the view on the current user you want to delete ?


Thanks :)

crimcrow
Автор

I prefer this way, a bit less code:
function confirmDeleteAction(uniqueId, isDeleteClicked) {
var deleteSpan = $("#deleteSpan_" + uniqueId);
var confirmDeleteSpan = $("#confirmDeleteSpan_" + uniqueId);

if (isDeleteClicked) {
deleteSpan.hide();
confirmDeleteSpan.show();
}
else {
deleteSpan.show();
confirmDeleteSpan.hide();
}
}

Also, if you have a long list of users, you would find that for users that you have to scroll down the page to find, each time you click 'Delete' or 'No' for those users, the page goes back to the top. To avoid this, add a 'return false;' after your call to confirmDelete, like this:

conaxlearn
Автор

Nice videos. Need more videos asap for help

deximsoft
Автор

Is there a way i can do it as a bootstrap popup ?

Hamza-Shreef
Автор

thanks, how to implement Soft Delete?

rdrgox
Автор

@kudvenkat
The js file is not working if is i am using section like us discuss in part 29 but when i use the js code in the view page directly it's work what the problem here ?
_layout page
<div>
@RenderBody()
</div>
@RenderSection("scripts", false)
</div>
Listuser viw page
@section scripts
{

<script
}
the script path apears so in the source page but not working the code !!

absoly
Автор

Getting the error "Failed to load resource: server responded with a status of 404" and "Uncaught ReferenceError:confirmDelete is not defined at HTMLAnchorElement.onclick.

When I do a viewsource on ListUsers page it does show the script line

</div>


<script



</div>

</div>

</body>

</html>

how do I fix this issue ?

SD-gjby
Автор

One thing is that I don't understand, in the function of js - how in the function of js knows to call the respective id's from the span ? because are declared locally.

nolimitsREAL
Автор

Hi kudvenkat sir good morning
I am a begineer. I understand some of the concepts from this is tutorial but I am still unable to do delete operation on employee repository can u please guide me.

NimbuYT
Автор

Hi Sir,
We want Azure Tutorials too.

tharindusenevirathna
Автор

This does NOT work on a hosted site. Can anybody show us how to implement that on PRODUCTION level?

parlamasisidoros