Jquery noty plugin get confirmation value

338 Views Asked by At

After reading a multiple posts here and trying to make my code work nothing really helped me. What i am trying to accomplish is to get the return value from noty when user click the "Ok" button in dialog message. I want to get that value in C# codebehind and continue with further logic. Messagedialog is working and displaying as expected but i cant fugure out how to get the true/false when user click ok. Thanks in advance!

<asp:Button ID="btnInactivate" runat="server" Text="Inactivate" OnClick="btnInactivate_Click" Visible="false" CssClass="buttonInactivate"/> 

protected void btnInactivate_Click(object sender, EventArgs e)
{           
    this.ClientScript.RegisterStartupScript(this.GetType(), "script", "confirm_noty();", true);

    var retValue = noty........
    // get the value from noty 
    // button ok pressed ... continue with further process....
}

function confirm_noty() {
 var n = noty({
    layout: 'center',
    type: 'warning',
    text: 'Do you want to inactivate current record?',
    dismissQueue: true,
    theme: 'defaultTheme',
    modal: true,
    buttons: [
           {
               addClass: 'btn btn-primary', text: 'Ok', onClick: function ($noty) {

                   // this = button element
                   // $noty = $noty element

                   $noty.close();
                   noty({
                       dismissQueue: true, force: true, layout: 'center', theme: 'defaultTheme', text: 'Record successfully inactivated.', type: 'success',
                       "animateClose": { "height": "toggle" }, "speed": "550", "timeout": "1200", "closable": true, "closeOnSelfClick": true
                   });
               }
           },
           {
               addClass: 'btn btn-danger', text: 'Cancel', onClick: function ($noty) {
                   $noty.close();
               }
           }
    ]
});

}

0

There are 0 best solutions below