I'm trying to develop a lookup form in asp.net (vb), when a button is
clicked a small search form will open in a second window which will display
a list of values. When a value is selected the clicking oF a button on this
form will close the window and return the value to the original form.
I've used VS2003 to create an ASP.NET application into which I added
webform1.aspx & webform2.aspx, the code behind these forms is below;
The Parent Form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
v1 = TextBox1.Text
Dim popupScript As String = "<script language='javascript'>" &
"window.open('webform2.aspx', 'CustomPopUp', " & "'width=600, height=400,
menubar=no, resizable=no, top=200, left=200')" & "</script>"
Page.RegisterStartupScript("PopupScript", popupScript)
End Sub
v1 is defined as a public string in an attached module.
The Search Form
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Text = v1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
v1=textbox1.text;
Dim popupScript As String = "<script language='javascript'>" &
"window.opener.location.href=window.opener.locatio n.href;window.close()" &
"</script>"
Page.RegisterStartupScript("PopupScript", popupScript)
End Sub
When data is entered into a textbox on the parent form and the button is
clicked the small search window opens and the data is displayed in its
textbox. If I make changes to the data and then click its button the window
closes but no data is displayed in the original textbox.