views:

70

answers:

2

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

+1  A: 

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
        });
    });
Genady Sergeev
A: 

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"  />
ram