Hi,
On click of button in child window I perform some operations that update the database.
So this change is to be reflected in parent window textboxes after the performance of operation only.
For this I wrote a javascript function and on button click(attribute.add("onclick".....") I call this javascript which, in turn, calls server side function in order to get 2 values from database and pass these parameters to the javascript function.
Then I update the hiddenfield values with the given 2 parameters and then call the parent window function to update the values.
But the problem is the parent window is not being updated on when the button is clicked first click. When I click the second time it is updated, but i need to do this on immediate click of the button.
parent window javascript :
function GetSubTotalGrandTotalFromChild(SubTotal,GrandTotal)
{
document.getElementById(ctl00_ContentPlaceHolder1_frmPurchaseOrder_SubTotalAmountTextBox).value=SubTotal;
document.getElementById(ctl00_ContentPlaceHolder1_frmPurchaseOrder_GrandTotalTextBox).value=GrandTotal;
return true;
}
child window javascript :
function SendSubTotalGrandTotalToParent()
{
PageMethods.CallGetSubTOtalGrandTotalForPO(purchaseOrderId,OnGetMessageSuccess, OnGetMessageFailure);
var SubTotal = document.getElementById(ctl00_ContentPlaceHolder1_hideSubTotal).value;
var GrandTotal = document.getElementById(ctl00_ContentPlaceHolder1_hideGrandTotal).value;
window.opener.GetSubTotalGrandTotalFromChild(SubTotal,GrandTotal);
return true;
}
serverside procedure
[WebMethod(EnableSession = true)]
public static string CallGetSubTOtalGrandTotalForPO(string queryStringPoId)
{
string subTotalQty;
string grandTotalQty;
int purchaseorderid;
purchaseorderid = Convert.ToInt32(queryStringPoId);
GetSubTOtalGrandTotalForPO1(purchaseorderid,out subTotalQty, out grandTotalQty);
return string.Format("{1}{0}{2}{0,subTotalQty,grandTotalQty);
}