Click here to Skip to main content
15,905,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I am opening a popup [i-frame] on button click in the Parent page. After i have done the operations in the popup page i am setting the values in parent page from the popup page. I can access the elements of the parent page and i am setting the values in the elements. however post back occurs and my values are lost.

this is the code that i am using in the child page or the pop up page which is inside a iframe.
$('input[id*="MyId"]:first', window.parent.document).val($('#<%= MyValue.ClientId%>').val());
$('input[id*="txtDesc"]:first', window.parent.document).val('hello');



any suggestions how can i keep the values ??
Posted
Updated 19-Jan-16 0:52am
v3
Comments
Kornfeld Eliyahu Peter 19-Jan-16 6:31am    
Try window.frameElement.ownerDocument instead of window.parent.document...
Riya-Pandey 19-Jan-16 6:49am    
window.parent.document is working fine. i checked just now that it is also setting the value in the corresponding fields. however post back is happening and i am loosing the values then. any suggestions. Can't use querystring , session , viewstate etc.
Kornfeld Eliyahu Peter 19-Jan-16 6:51am    
Stop post-back by return(false); or use AJAX...
Riya-Pandey 19-Jan-16 7:08am    
even if i am returning false or setting e.preventDefault() from child page, post back happens
Kornfeld Eliyahu Peter 19-Jan-16 7:14am    
You maybe doing it at the wrong place...
Please show the relevant code for the click...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900