Problem:
Chrome is not rendering my class addclass
before calling my confirmation window window.confirm
is like if it got stuck and was released only after the confirmation.
What I did was put the call of the function ConfirmaExclusao
to OnClientClick
of a image button
that is within a TemplateField
in gridview
, the intent of the commit when it returns false
is not to call the% RowCommand
in which effective deletion.
This solution for IE 9, 10 and 11 works, but pro chrome does not ...
Example:
Have an example here of the problem link can see that for chrome the class is applied after the confirmation window exit .
My javascript functions:
function MarcarLinha(linha) {
//Soma 2 na linha (1 linha do Cabeçalho e mais uma poque o TR da grid começa em 1, não em zero)
linha = linha + 2;
//Limpa todas as marcações
$('[id$=gridViewListaCondicoesComlRCTRVI]').find('tr').each(function (row) {
$(this).removeClass('hover_row');
});
$('[id$=gridViewListaCondicoesComlRCTRVI] tr:nth-child(' + linha + ')').addClass('hover_row');
}
function ConfirmaExclusao(linha) {
MarcarLinha(linha);
//Confirmar a exlusão
if (window.confirm('Deseja realmente excluir este registro?'))
return true;
else {
//$('[id$=gridViewListaCondicoesComlRCTRVI] tr:nth-child(' + linha + ')').removeClass("hover_row");
return false;
}
}
My ImageButton inside the gridview:
<ItemTemplate>
<asp:ImageButton ID="imgBtnExcluir32" runat="server" CommandName="Excluir" CommandArgument='<%#Container.DataItemIndex%>'
ImageUrl="~/images/delete.png" OnClientClick='<%# "return ConfirmaExclusao(" + ((GridViewRow)Container).RowIndex + ");" %>' />
</ItemTemplate>