</asp:content>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
' Assign Popup Code
cmdDemo3.Attributes.Add("onClick", "return utOpenChild('Child.aspx?ID='" & txtDemo1.Text & ", 270, 160, 'oChild');")
End If
End Sub
Protected Sub cmdDemo3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdDemo3.Click
' Assign Data from Session
txtDemo1.Text = Session("DataFromChild")
' Clear Variable
Session.Remove("DataFromChild")
End Sub
Child form
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
lblChild1.Text &= Me.Request.QueryString("ID") '<-- to be implemented
End If
End Sub
Private Sub cmdChild1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdChild1.Click
' Variables - The use of a stringbuider would be more elegant but only a few concatanations take place
Dim sJava$
' Create Function in Page
sJava &= "<script language='javascript'>"
' Store Data In Session
Session("DataFromChild") = DropDownList1.SelectedValue
' Assign True Value
sJava &= "self.returnValue =" & DropDownList1.SelectedValue & ";"
sJava &= "alert(self.name);"
' Complete Script
sJava &= "self.close();"
sJava &= "</script>"
' Register String
RegisterStartupScript("CloseChild", sJava)
End Sub
<form id="Form1" method="post" runat="server">
<asp:Label id="lblChild1" style="Z-INDEX: 100; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server" BorderStyle="Inset" BorderWidth="1px" Width="248px" Height="31px" Font-Names="Tahoma" Font-Size="11px" ForeColor="Red">Message</asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" Style="z-index: 104; left: 9px;
position: absolute; top: 52px" AutoPostBack=false >
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList>
<asp:Button id="cmdChild2" style="Z-INDEX: 102; LEFT: 8px; POSITION: absolute; TOP: 104px" runat="server" Width="160px" Height="24px" Text="Cancel" Font-Names="Tahoma" Font-Size="11px" Visible="False"></asp:Button>
<asp:Button id="cmdChild1" style="Z-INDEX: 103; LEFT: 192px; POSITION: absolute; TOP: 104px" runat="server" Width="65px" Height="24px" Text="OK" Font-Names="Tahoma" Font-Size="11px"></asp:Button>
</form>