2
I have a ListView
which creates some buttons dynamically according to Idpassoworkflow,
and as the step I need presents a message to the user confirms whether or not to execute the action,
only that the dialog Jquery
does not open when clicked on button.
ListView
what I use to press the 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>
instead of using . click, try using . on("click" .. objects created dynamically after the instance of . click has no event Rigger, already using the on("click" the current objects and the new ones will receive the Rigger. I have not reached the fore, but it does not cost to try.
– Hoppy
I took the test, but it still won’t open
– Marco Souza