What I'm doing is a download of an Excel file when I find any record that already exists in the bd, this is mainly responsible for detecting it, not saving it and downloading an Excel indicating the repeating records, the problem begins when apart from doing that I execute a modal indicating that there have been records that could not be entered into the bd because they would be duplicated.
Current code:
Code C #:
Page.ClientScript.RegisterStartupScript(GetType(), "hwa", "downloadError('Temp/ReportUsers" + FilesTemplate.Length + ".xlsx');", true);
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename=ReportUsers.xlsx");
Response.BinaryWrite(pck.GetAsByteArray());
JS Code:
function downloadError(download) {
$.confirm({
title: "Repetido",
template: 'danger',
message: 'Hay llaves repetidas',
buttonCancel: false,
onOk: function() {
return;
}
});
$(".modal-body").html("<div class='text-center'><label style='font-size:12px;' >Hay llaves repetidas que no se pudieron insertar.</label><br/><a href='" + download + "'>Descargar llaves</a></div>");
$("button[data-confirm=Ok]").html("Confirmar");
}
In fact there is no execution of any action, whatever the reason and I do not know if it does not do postback when the download is made, the page stays there, but then how can I do an extra action after the download.