开发者

ASP:Button don't works in a jquery dialog

Hi have a jquery dialog:

the js source is:

   $(document).ready(function() {                           
            $("#DialogConfirmationDiv").dialog({
                bgiframe: true,
                autoOpen:false,
                height: 140,
                title: "Confermi l' invio?",
               modal: true
            });
}

the html source is:

<div id="DialogConfirmationDiv" title="Conferma nota spese">           
       <asp:Button ID="ConfermaSi" runat="server" Text="Si" OnClick="ButtonSalva_Click" OnClientClick="$('#DialogConfirmationDiv').dialog('close');return true;"  />
       <asp:Button开发者_运维百科 ID="ConfermaNo" runat="server" Text="No" OnClientClick="$('#DialogConfirmationDiv').dialog('close');return false" />
</div>

the button ConfermaNo works.

On the click event ConfermaSi close itself but don't call the ButtonSalva_Click method. I tried with debugger and breakpoints on this method bur it's not called.

How can i do ? thanks


I have tested that on my machine and as far as I can see the ButtonSalva_Click is fired. Are there any javascript errors on the page that you test on? Does the page flicker when you press the si button, as it is posting back to the server?

The only change from your code is that I have added some missing brackets:

$(document).ready(function() {
        $("#DialogConfirmationDiv").dialog({
            bgiframe: true,
            autoOpen: false,
            height: 140,
            title: "Confermi l' invio?",
            modal: true
        });
    });


I was able to reproduce your issue. Your "Yes" button is doing a submit. Try this with "return true" removed

<asp:Button ID="ConfermaSi" runat="server" Text="Si" OnClick="ButtonSalva_Click" OnClientClick="$('#DialogConfirmationDiv').dialog('close');" UseSubmitBehavior="false"  />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜