Search code examples
c#asp.netpopupquery-stringthickbox

Passing data from thickbox popup to parent through querystring


Calling Thickbox popup from Parent Page ServiceTicket.aspx like this :

function OpenCustomerView(companyID, accountID) {
var e = document.getElementById('<%= txtAccountID.ClientID %>');
var custId = e.value;
**var url = "CustomerSearch.aspx?custid=" + custId + "&TB_iframe=true&width=1200&height=800";**
**tb_show("Customer Search", url);**
}

And on Child Popup Window CustomerSearch.aspx i m using this code to close the popup and sending values back to parent :

 function CloseDialog(tanksize,companyID, accountID, address, serviceContract, cod, divisionId) {
 **var url = 'ServiceTicket.aspx?CompanyID=' + companyID + '&AccountID=' + accountID + '&Address=' + address.replace('#', '%23') + '&TankSize=' + tanksize + '&divisionId=' + divisionId;**
}

in above line var url='ServiceTicket.aspx?CompanyID=' this is how i m passing values to parent window.

Handling values on Parent Page with C# Code behind

if (Request.QueryString["companyID"] != null && Request.QueryString["companyID"] != "")
        {
            short companyID = Convert.ToInt16(Request.QueryString["companyID"]);
       }

So I need help in closing this child popup from function CloseDialog and passing values to parent by that var url used in the closedialog function.Please guide me or share your code...


Solution

  • Not sure if this will work or not as it was a way long back I did something like this for similar issue. Just give try and see if works out else notify here will update again.

    function CloseDialog(tanksize,companyID, accountID, address, serviceContract, cod, divisionId) {
        tb_remove();
        var url = 'ServiceTicket.aspx?CompanyID=' + companyID + '&AccountID=' + accountID + '&Address=' + address.replace('#', '%23') + '&TankSize=' + tanksize + '&divisionId=' + divisionId;    
        window.parent.location.href = url;
    }