We all know that the use of this keyword is that it is used for the current reference of the control or anything from where the invocation is being made.
So for making the proper use of this keyword we need to deal with the dynamic id of the control we are using in our project.
@Html.ActionLink("Delete", "Delete", new { id = item.EmpId }, new { @class = "lnkDelete" })
First we have made the id according to the values of the model called as the dynamic id generation.
$(".lnkDelete").live("click", function (e) {
// e.preventDefault(); use this or return false
url = $(this).attr('href');
$("#dialog-confirm").dialog('open');
return false;
});
Then we will use it get the current id of the record to be deleted.
<div id="dialog-confirm" style="display: none">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Are you sure to delete?
</p>
</div>
We will pass the id into the partial view and delete the detail of the employee.
0 Comment(s)