Confirmation message after clicking the ActionLink in MVC

Confirmation message after clicking the ActionLink in MVC using Razor

 

Kindly click here to know more detail about this post here. For more new posts kindly visit dotnet-helpers.com

 

Controller

Create view for the ConfirmationDialog to show the confirmation message.If click ok it will redirect ConfirmationDialog
view else it stay in index view

public ActionResult ConfirmationDialog()
{
return View();
}
From action create view as like below
ConfirmationMessage

ConfirmationMessage1

View (index)

@{
ViewBag.Title = “Home Page”;
}

@Html.ActionLink(“Click to Confirm”, “Confirmation”, null, new { onclick = “return ConfirmationDialog()” })

function ConfirmationDialog() {
if(confirm(“Are you sure to continue?”))
return true;
else
return false;
}

OUTPUT:

 

Kindly click here to know more detail about this post here. For more new posts kindly visit dotnet-helpers.com

 

If you click ok, it will redirect to the Confirmation.cshtml view