Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to avoid entire page refreshment value passing value from popup to parent
parent page---------
JavaScript
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="Javascript" type="text/javascript">
       
    
        function sss() {
            var popup = window.open('pop.aspx', 'popup_id', 'scrollbars,resizable,width=300,height=400');
        }
        function test() {
            //Access the popup elements using this ID and fetch data from it
           
            var data = popup.document.getElementById('txtname').value;
            //document.frm.txt.value = data;
            alert(data);
            document.getElementById('txtid').value = data;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <div>
        
    </div>
       <asp:TextBox ID="txtid" runat="server"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" 
            onclientclick="sss()" />
        <asp:Button ID="btnSearchCriteria" runat="server" Text="Button" 
            onclientclick="test()" />
  </ContentTemplate>
    </asp:UpdatePanel>  </form>
</body>
</html>

popup-----------

JavaScript
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="pop.aspx.cs" Inherits="pop" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script language="Javascript" type="text/javascript">
    function RefreshParentPage() {
       
       // window.opener.document.getElementById('txtid').value = document.getElementById('txtname').value;
        window.opener.document.getElementById('btnSearchCriteria').Click();
       
        window.close();
} 
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <asp:TextBox ID="txtname" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" 
            onclientclick="RefreshParentPage()" Text="Button" />

    </div>
    </form>
</body>
</html>


but its not working
Posted

1 solution

1. Remove the test() function from the base page (the opener page).
2. Insert "return false;" as the last statement of the sss() function.

Hope it helps, if helps please mark it as answer. :)
 
Share this answer
 
Comments
Member-515487 23-Oct-12 0:45am    
i want to transfer value popup to base page
if test() is remove den???

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