Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The reason your value isn't showing is because the page that opens the pop-up isn't refreshing to show the new value.</p> <p>In your lnkBack_Click try setting message to this.</p> <pre><code>message = "window.close();" message += "if (window.opener &amp;&amp; !window.opener.closed) {" message += " window.opener.location.reload();" message += "}" </code></pre> <p>This will close the pop-up and tell the first page to reload.</p> <p>EDIT: Update the field with javascript instead of re-loading</p> <p>What we will do is pass the id of the field we want to update to the popup. When the user clicks the button we find the field on the opening page and update it. We no longer need to use session to pass the values. I am not at a PC where I can test the code, so it might not work as is. I don't do any error checking, you will want to add this.</p> <p>Partial Class ListBox1 Inherits System.Web.UI.Page</p> <pre><code>Public Const JS_START As String = "&lt;script language=javascript&gt;" Public Const JS_END As String = "&lt;/script&gt;" Public Const DBQT As Char = Chr(34) Protected Sub lnkWindowOpen_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkWindowOpen.Click Dim message As String Dim script As String message = "" message += "window.blur();" message += "window.open(" &amp; DBQT &amp; "ListBox1_sub.aspx?ctrl=" &amp; txtReturn.ClientId &amp; DBQT &amp; ",null," message += DBQT &amp; "height=200,width=400,top=300,left=325," message += "status=yes,toolbar=no,titlebar=0,menubar=no,location=no,scrollbars=0,resizable=0;modal=yes" &amp; DBQT &amp; ");" script = JS_START &amp; message &amp; JS_END ClientScript.RegisterClientScriptBlock(Page.GetType, Guid.NewGuid().ToString(), script) End Sub </code></pre> <p>End Class</p> <p>Partial Class ListBox1_sub Inherits System.Web.UI.Page</p> <pre><code>Public Const JS_START As String = "&lt;script language=javascript&gt;" Public Const JS_END As String = "&lt;/script&gt;" Public Const DBQT As Char = Chr(34) Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged TextBox1.Text = ListBox1.SelectedItem.Text End Sub Protected Sub lnkBack_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkBack.Click Dim message As String Dim script As String message = "window.close();" message += "var ctrl = window.opener.document.getElementById('" &amp; Request.QueryString("ctrl") &amp; "');" message += "ctrl.value = '" &amp; TextBox1.Text.Replace("'", "\'") &amp; "';"; script = JS_START &amp; message &amp; JS_END ClientScript.RegisterClientScriptBlock(Page.GetType, Guid.NewGuid().ToString(), script) End Sub </code></pre> <p>End Class</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload