是否可以从JQuery OnClient Click事件调用网页LOAD事件?

时间:2017-06-15 06:43:50

标签: c# jquery asp.net

我创建了一个对话框,调用用户Control来创建网格并分别填充它。但是之前使用过这个用户控件,所以当我显示对话框时,它显示的是同一个网格。因此,为了再次调用用户控件,我希望它的load事件再次被触发。是否有可能做到这一点。以下是我的代码:

HTML

<%@ Register TagPrefix="uc" TagName="ReviewGroupGrid" Src="UserControls/ReviewGroupGrid.ascx" %>
<%@ Register TagPrefix="uc" TagName="ReviewGroupGrids" Src="UserControls/ReviewGroupGrid.ascx" %>
<%@ Register Assembly="OCM.Phoenix.WebToolsFramework.Server.Modules.DataSteward.WebExtensions" Namespace="OCM.Phoenix.WebToolsFramework.Server.Modules.DataSteward.WebExtensions" TagPrefix="cc1" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="DataStewardContent">

<cc1:Button ID="btnMerge" runat="server" Text="Merge &amp; Edit" OnClick="btnMerge_Click"
                            OnClientClick="javascript:return reviewGroupForm.getSelectedRowsForMerge()" />
<div class="modal-dialog" id="updateClaimConfirmPopUp" style="display: none">
    <div class="modal-content">
        <div class="modal-header" id="popUpHeader">
            <button type="button" class="close closeClaimPopUp">
                <span>&times;</span></button>
        </div>
        <div class="modal-body" id="confirmData">
            <div id="random"></div>
            <div class="dataTable_wrapper">
                <div class="table-responsive">
                    <uc:ReviewGroupGrids ID="reviewGroupCtrls" runat="Server" />
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <asp:LinkButton ID="claimMerge" CssClass="buttonClassClaim btn btn-primary" runat="server" Text="Accept" OnClick="btnMerge_Click"/>
            <button type="button" id="btnClosePopUp" class="buttonClassClaim btn btn-primary closeClaimPopUp">
                Discard</button>
        </div>
    </div>
</div>
</asp:Content>

的jQuery

getSelectedRowsForMerge: function () {
                               var entityType = $("input[id*='hdnEntityType']").val();
                                if (entityType === "19") {
                                $('#popUpHeader').find('h4').remove();
                                $('#random').find('h4').remove();
                                $('#popUpHeader').append('  <h4 class="modal-title" >  ' + 'Need Your' + ' Attention!</h4>');
                                $('#random').append('<h4><b> ' + 'The Claims that you are merging are associated with different patients, merging the claims will result in explicit merging of the associated Patients as well, Please review the patient(s) details shown below before merging the claim' + '</b></h4>');
                                //$('#confirmData').append('<div class="table-responsive"').append(' <uc:ReviewGroupGrid ID="reviewGroupCtrl" runat="Server" />').append('</div>');
                                $("#updateClaimConfirmPopUp").dialog({
                                    autoOpen: true,
                                    width: 1600,
                                    resizable: false,
                                    draggable: true,
                                    modal: true,
                                    show: { effect: 'blind' }
                                });
                            }
},

创建对话框时,它正在创建用户控件,但已填充此用户控件。我想调用它的load事件,以便用户再次控制进程。我可以在打开对话框时通过点击事件执行此操作吗?

1 个答案:

答案 0 :(得分:0)

你想让btnMerge每次显示时刷新div。如果是这样,那么您需要通过getSelectedRowsForMerge中的ajax调用从服务器获取数据,这可以更新ReviewGroupGrids控件中显示的数据。在此承诺的成功处理程序中,将弹出窗口设置为显示而不是立即显示。这将刷新div中的所有内容,而不需要任何服务器端加载事件

摘录如下,请添加实际代码

getSelectedRowsForMerge: function () {
// various cleanups as present
$.ajax(...)
    .success( function() {
            //show the div
             $("#updateClaimConfirmPopUp").dialog({  ....  } );
           })