简体   繁体   中英

Inside the jquery popup dialog asp button doesn't fire event

I have following snippets for popup dialog

$(document).ready(function () {
            $('a#MainEdit').live('click', function (e) {
                var page = $(this).attr("href")
                $.fx.speeds._default = 900;
                var $dialog = $('<div id="Editdialoge"></div>')
                .html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>')
                .dialog({
                    autoOpen: false,
                    modal: true,
                    height: 580,
                    width: 700,
                    resizable: false,
                    show: "fade",
                    title: 'Edit Employee Details',
                    open: function () {
                        $(":button:contains('Close')").hide();
                        $('.ui-dialog-buttonpane').hide();
                    },

                    buttons: {
                        "Close": function () { $dialog.dialog('close'); }

                    },
                    close: function (event, ui) {
                        __doPostBack('<%=updAccountObject.ClientID %>', '');

                    }
                });
                $dialog.dialog('open');
                e.preventDefault();
            }); 

This is my button

<asp:Button ID="btnAddEmployee" runat="server" Text="Add" CssClass="pms_btn"   OnClick="btnSubmit_Click">

Button can not fire the click() event. I need help to fire the server event.

Please make your question more clear.

Be any problem(ID or jquery), I guess this will fix your problem.

Don't use live function, it has been deprecated now.

Instead, use this line:

$('a#MainEdit').on('click', function (e) {

or

$(document).on("click", "a#MainEdit", function() {

I hope this works for you.

对于按钮,我更喜欢使用:

$('<%=updAccountObject.ClientID %>').click();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM