How to display the warning message in asp.net mvc ?


Warning_Msg

while working in asp.net mvc we will get scenario to display the alert or warning message while deleting or editing the record, then we can achieve that functionality by using this code as given below


// Alert message for edit record
@Html.ActionLink("Edit","Index",new {Id=item.Id},new { onclick = "return confirm('Are you sure do you want to edit the record ?');" })
// Alert message for delete the record.
@Html.ActionLink("Delete","Delete",new {Id=item.Id},new { onclick = "return confirm('Are you sure you wish to delete this record "+@item.Id +"?');" })

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.