2

On page load I am opening a popup window for Terms and Condition. Once user will click on the accept button of terms and condition popup, I need to do some DB operation on button click once the operation will complete I need to close the popup and and show the parent window and on the parent window I need to pass the DB return value

$(document).ready(function () { 
        $.customDialogPopUp('Terms & Condition', '../Requisitions/TermsCondition.aspx', 95, 512);
    });

this is opening the popup. On button click of popup window

    protected void btnApproved_Click(object sender, EventArgs e)
    {
        try
        {
          // DB Operation...
          // var ReqId = DB return val
          //ClientScript.RegisterClientScriptBlock(this.GetType(), "ClosePopup", "<script>CloseDialog1(); window.location.href =" + "../Requisitions/NewRequisition.aspx?ReqID="ReqId + ";</script>", true);

        }
        catch (Exception ex)
        {

        }
    }

I am struggling with line 3 of try block.

Rocky
  • 4,454
  • 14
  • 64
  • 119

1 Answers1

0

Have done almost same things, but guess it's a little stupid method.
In parent page, add below in javascript section.

function refreshByBtn() {
    document.getElementById('<%= btnApproved.ClientID %>').click();
}

In child page, add to javascript, too.
guess you might modify code below.

window.onunload = refreshParent;
function refreshParent(){
    self.opener.refreshByBtn();
}

When close child will trigger btnApproved_click() and then postback the parent page.

kcwu
  • 219
  • 2
  • 6