Reputation: 387
Work on ASP.NET Visual Studio 2008 C#. I have a page. From this page I need to call a page on popup. On the popup page selected value will be set on the parent page text control.
- One parent page
- One child page.
- Call parent to child as popup.
- On popup window contain a grid.
- On popup grid have command select,click on select close popup and selected value will set on parent page text control.
I have done steps 1,2,3 and 4. But I need to complete step no 5.
Upvotes: 1
Views: 26700
Reputation: 4232
On parent page:
<script type="text/javascript">
function f1() {
window.open("child.aspx");
}
</script>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><input type="button" onclick="f1();" value="pop up" />
On child page:
<script type="text/javascript">
function f2() {
opener.document.getElementById("TextBox1").value = "hello world";
}
</script>
<input type="button" value="return hello world" onclick="f2();" />
Also you can pass ID of control which you want fill from child page as GET parameter:
window.open("child.aspx?controlID=<%=TextBox1.ClientID %>");
Upvotes: 9