Hi all,
I have a link to delete action using Jquery dialog confirm message. Clicking on delete link, a modal popup is showing with a confirmation question. Button Yes is triggered to submit the form with id = Model.Id
<td>
<% using (Html.BeginForm<AssessorActionPlanController>(
c => c.Delete(Model.Id), FormMethod.Post, new { id = Model.Id }))
{ %> <%= Html.AntiForgeryToken()%>
<a href="#" onclick="ConfirmeDialog('<%= Model.Id.ToString() %>');">
Delete
</a>
<% } %>
</td>
this work fine.
Now instead of this I want just to write a Html helper wich will do this work, something like
<td>
<%= Html.DeleteActionLink<ControllerName>(
c => c.Delete(Model.Id), "Delete"
); %>
</td>
the js is:
$('#deleteDialog').html('Are you sure you want to delete this item ?');
$('#deleteDialog').dialog({
autoOpen: false,
modal: true,
resizable: false,
buttons: {
'Yes': function() {
$(this).dialog('close');
$("form[id='" + submitFormHandler + "']").submit();
},
'No': function() { $(this).dialog("close"); }
}
});
So is it possible to write such helper and if it is posible please give some tips, Thanks