Hi,
I am trying to pass a textbox value from a popup window to the parent window textbox.
My parent window HTML looks like ,
<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “
<html xmlns=”
<head runat=”server”>
<title>Untitled Page</title>
<script language=”javascript” type=”text/javascript”>
function GetValueFromChild(myVal)
{
var ddl= document.getElementById(“DropDownList1”);
var opt = document.createElement(“option”);
opt.text=myVal;
ddl.options[ddl.options.length].add(opt);
}
</script>
</head>
<body>
<form id=”form1″ runat=”server” >
<div>
<asp:TextBox ID=”TextBox1″ runat=”server” Style=”z-index: 104; left: 385px; position: absolute;
top: 358px”>default text</asp:TextBox>
</div>
</form>
</body>
</html>
My Popup page looks like ,
<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”AddCompany.aspx.cs” Inherits=”AddCompany” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “
<html xmlns=”
<head runat=”server”>
<title>Add New Company</title>
<script type=”text/javascript”>
function SetValueInParent()
{
window.opener.document.getElementByID(“TextBox1”).value= document.getElementById(<% = txt1.ClientID %>).value;
window.close();
return false;
}
</script>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<h2>Add A New Company:</h2>
<br /><br />
Enter Company Name:    <asp:TextBox ID=”txt1″ runat=”server” /><asp:Button ID=”button1″ runat=”server” Text=”Save” OnClick=”button1_Click” OnClientClick=”javascript:returnSetValueInParent()”/> </div>
</form>
</body>
</html>
But when I am clicking the popup page button, the value frm the popup paeg is not getting populated in the parent page.
I could not find the reason.
Any reply will be appriciated.It is a kind of urgent.