How to exit aspx page by gridview selectedindex changed event and selected session update in another window
<p>I have a textboxes and dropdowns in a form .. Am searching a person details from another form am giving sessions to fields.. After getting the sessions i have to close search form in my main form fields to be affected.. Am trying to close search form but am getting postback error.. My code is like this..</p>

<p><strong>Serach Form</strong>(Contains Grid)</p>

<pre><code>&lt;asp:GridView runat="server" ID="grid_search_res" AutoGenerateColumns="false" DataKeyNames="PMRN" OnSelectedIndexChanged="grid_search_res_SelectedIndexChanged" OnRowCreated="grid_search_res_RowCreated"&gt;
&lt;Columns&gt;
&lt;asp:ButtonField ControlStyle-CssClass="fa fa-search" Text="Select" HeaderText="Select" /&gt;
&lt;asp:BoundField DataField="PMRN" HeaderText="PMRN" /&gt;
&lt;asp:BoundField DataField="Name" HeaderText="Name" /&gt;
&lt;asp:BoundField DataField="Adress" HeaderText="Address" /&gt;
&lt;asp:BoundField DataField="Phone" HeaderText="Phone" /&gt;
&lt;/Columns&gt;
&lt;/asp:GridView&gt;
</code></pre>

<p><strong>Code</strong></p>

<pre><code> protected void grid_search_res_SelectedIndexChanged(object sender, EventArgs e)
  {
    grow = grid_search_res.SelectedRow;
    Pmrn = grid_search_res.DataKeys[grow.RowIndex].ToString();

    DataTable dt = getado.retrievedata("Exec S_POP_PatientDetails 2 , '" +Pmrn + "' , 0 , 100 , 1");
    if (dt.Rows.Count &gt; 0)
    {
    Session["pmrn"] = dt.Rows[0]["PMRN"].ToString();
    }
   ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "window.close();", true);
 }        
</code></pre>

<p><strong>Main Form</strong></p>

<pre><code>&lt;asp:TextBox runat="server" ID="txt_PMRN" CssClass="form-control"&gt;&lt;/asp:TextBox&gt;
</code></pre>

<p><strong>I Want this txt_PMRN to be fill with the session PMRN
When am exiting the search form</strong></p>

<p>Please Help Me </p>

<p>Thank you</p>