Home > other >  Show bootstrap modal on server side validation
Show bootstrap modal on server side validation

Time:10-07

I have a ASP.Net Core MVC web application. I have a standard razor view which has a list of items with a delete button. What I want to do is if they user deletes an item from the grid go to the server calling an action which validates the item selected. IF invalid I want to return to the view and show a bootstrap modal explaining why the delete cannot be carried out. I call the delete routine using Controller / Action tag helpers and pass the unique Id to a controller event.

So basically if my delete validation fails show a modal dialog with a message. Any help please?

CodePudding user response:

I ended up sorting this myself. Basically I set a viewbag property and give it a value of show. Then in my script section of my view I set the modal property to that viewbag.

  • Related