2

我使用 java 脚本 Alertify 库来使用花哨的警报。但是当我想在客户端使用确认框时遇到问题,如果它是真的,那么它应该运行服务器端事件。但是只需单击按钮它就会运行服务器端代码..这是该代码:如果我选择请帮助我好的,那么我应该运行服务器客户端..

  <asp:ImageButton id="remove" runat="server"
                                       ToolTip="Delete" 
                                       CssClass="controlbuttonjob"
                                           onClientClick="return  alertify.confirm('Are you sure you want to Delete?')"
                                           OnClick="remove_click"
                                           ImageAlign="left"
                                           ImageUrl="~/Style/delete.png"


                                              RowIndex='<%# Container.DisplayIndex %>'
                                          />
4

2 回答 2

0

This type of dialogs are runs and return right away.

Later if you press some of their buttons like the cancel or the ok they call the function that you have set.

The confirm is not even return true or false, is return the object of the dialog.

// from the http://fabien-d.github.io/alertify.js/
// confirm dialog
alertify.confirm("Message", function (e) {
    if (e) {
        // user clicked "ok"
    } else {
        // user clicked "cancel"
    }
});

So this is not working like the confirm() that waits for the user input.

于 2013-06-15T01:52:26.037 回答
0
alertify.confirm("Message", function () {
    //clicked OK
    return true;
}, function(){
    //clicked Cancel
    return false;
});
于 2013-06-15T02:02:06.093 回答