I have a ListView
that creates some buttons dynamically according to IdPassoWorkflow,
and according to the step I need presents a message to the user confirms whether or not to execute the action,
except that the Jquery
dialog window does not open when the button is clicked.
% of what I use to load buttons
<asp:ListView ID="lvBotoes" runat="server">
<ItemTemplate>
<asp:LinkButton ID="lnkGravar" OnClick="lnkGravar_Click" runat="server" CssClass="btnInline"
OnClientClick='<%#Eval("IdPassoWorkflow","javascript:return CheckConfirm({0});" )%>'
CommandArgument='<%# Eval("IdPassoWorkflow") %>'>
<%# TextoBotao(Container.DataItem) %></asp:LinkButton>
</ItemTemplate>
</asp:ListView>
My Jquery
<link type="text/css" href="../CSS/Jquery/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
<link href="../CSS/Jquery/estilos.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../Scripts/modernizr.js"></script>
<script type="text/javascript" src="../Scripts/jquery-min.js"></script>
<script type="text/javascript" src="../Scripts/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
var SqlType = '<% =vsSqlType.Value%>';
var PassoWorkflow = parseInt(<% =vsIdPassoWorkflow.Value %>);
function CheckConfirm(IdPassoWorkflow) {
if (IdPassoWorkflow == 2)
{
$(function() {
var opcoesDialogo = {
autoOpen: false,
buttons: {
'Não': function(event) { $(this).dialog("close"); },
'Sim': function(event) {$(this).click += new EventArgs(this.lnkGravar_Click); }
}
};
$('.EncaminharGestor').dialog(opcoesDialogo);
$('#lnkGravar').click(function() {
$('.EncaminharGestor').dialog('open')
});
});
}
}
</script>
Message to be displayed.
<div class="EncaminharGestor" title="Janela de Confirmação">
<p>Encaminhar para o Gestor?</p>
</div>
The generated Html
<td colspan="2" class="Button">
<a href="javascript:__doPostBack('ctl00$BodyContent$lvBotoes$ctrl0$lnkGravar','')" class="btnInline" id="BodyContent_lvBotoes_lnkGravar_0" onclick="javascript:return CheckConfirm(1);">Salvar</a>
<a href="javascript:__doPostBack('ctl00$BodyContent$lvBotoes$ctrl1$lnkGravar','')" class="btnInline" id="BodyContent_lvBotoes_lnkGravar_1" onclick="javascript:return CheckConfirm(2);">Encaminhar</a>
<a href="javascript:__doPostBack('ctl00$BodyContent$lvBotoes$ctrl2$lnkGravar','')" class="btnInline" id="BodyContent_lvBotoes_lnkGravar_2" onclick="javascript:return CheckConfirm(5);">Excluir</a>
</td>