Pages

Showing posts with label Confirmation On Action link. Show all posts
Showing posts with label Confirmation On Action link. Show all posts

Monday, 14 July 2014

Confirmation on Action link click in mvc4

Confirmation:


Jquery alert
Get confirmation on action link click in mvc4.




@Html.ActionLink("LOG-OUT", "Logout", "Home", new { id = "logout" }, new { onclick = "return confirm('Are you sure you want Logout?')" }) In above code @Html.ActionLink() html helper is used to create an action link in mvc4 razore view. There are many overloads for action link so that the user can use it according to his requirement. Here I want a client side confirmation i.e. when user clicks on logout ActionLink then Javascript alert will be gets open as shown inn above image. Here I called confirm() javascript function inside the html property of @Html.ActionLink() html helper.