Controls in the Home page: TextBox, Button
Controls in Pop up: Gridview
What I want to achieve and used so far:
1. Enter text in the textbox and click on the button.
protected void btnLookUp_Click(object sender, EventArgs e)
{
string sScript = "<script>window.open('a.aspx?textbox=" + TextBox1.Text.ToString() + "','cal','left=10,top=10 resizable= yes scrollbars=yes') </script>";
RegisterClientScriptBlock("anything", sScript);
}
2. On Button-Click the pop-up opens and on-page load event of the popup page gets triggered.
Gridview control in pop-up page.
<asp:GridView ID="GridView1" runat="server" Font-Size="10px"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:CommandField SelectText="[...]" ShowSelectButton="True" />
</Columns>
<AlternatingRowStyle Wrap="False" />
</asp:GridView>
3. On clicking the button for the corresponding entry in the gridview I want to pass selected column values back to the TextBox control in the home page.
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string strScript = "<script>window.opener.document.forms(0)."+ control.Value.ToString() +".value = '";
strScript += "Amresh';self.close()";
strScript += "</" + "script>";
RegisterClientScriptBlock("anything", strScript);
}
The above code gives me error '; missing' as the the column values starts with an integer value.
How do I transfer values back to the textbox in the home from the popup page?
Or can I achieve it using some other method?