G
Guest
Hi,
I have a parent page that loads a popup and when the OK button is press it
pass the value back to the parent form textbox. It passes the value but it
doesn't close the popup but also open another copy of the popup. Guys I
checked everywhere. I get the same thing.
This is the code on the parent form webform1.aspx
HTML
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 240px; POSITION:
absolute; TOP: 144px" runat="server"
Text="Button"></asp:Button>
<asp:TextBox id="txtValue" style="Z-INDEX: 102; LEFT: 240px; POSITION:
absolute; TOP: 104px"
runat="server"></asp:TextBox>
</form>
</body>
VB CODE
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", "var strReturn;
strReturn=window.showModalDialog('child.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');if
(strReturn != null) document.getElementById('txtValue').value=strReturn;")
End Sub
This is the code for the child (popup) child.aspx
HTML
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtValue" style="Z-INDEX: 101; LEFT: 224px; POSITION:
absolute; TOP: 104px"
runat="server"></asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 224px; POSITION:
absolute; TOP: 144px" runat="server"
Text="Button"></asp:Button>
<asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 296px; POSITION:
absolute; TOP: 144px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
VB CODE
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Button1.Attributes.Add("onclick", "window.returnValue =
document.getElementById('txtValue').value; window.close();")
Button2.Attributes.Add("onclick", "window.close();")
End Sub
I would really appreciate any help on this. I gave it my best shot.
Thanks
I have a parent page that loads a popup and when the OK button is press it
pass the value back to the parent form textbox. It passes the value but it
doesn't close the popup but also open another copy of the popup. Guys I
checked everywhere. I get the same thing.
This is the code on the parent form webform1.aspx
HTML
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:Button id="Button1" style="Z-INDEX: 101; LEFT: 240px; POSITION:
absolute; TOP: 144px" runat="server"
Text="Button"></asp:Button>
<asp:TextBox id="txtValue" style="Z-INDEX: 102; LEFT: 240px; POSITION:
absolute; TOP: 104px"
runat="server"></asp:TextBox>
</form>
</body>
VB CODE
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", "var strReturn;
strReturn=window.showModalDialog('child.aspx',null,'status:no;dialogWidth:370px;dialogHeight:220px;dialogHide:true;help:no;scroll:no');if
(strReturn != null) document.getElementById('txtValue').value=strReturn;")
End Sub
This is the code for the child (popup) child.aspx
HTML
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="txtValue" style="Z-INDEX: 101; LEFT: 224px; POSITION:
absolute; TOP: 104px"
runat="server"></asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 224px; POSITION:
absolute; TOP: 144px" runat="server"
Text="Button"></asp:Button>
<asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 296px; POSITION:
absolute; TOP: 144px" runat="server"
Text="Button"></asp:Button>
</form>
</body>
VB CODE
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Button1.Attributes.Add("onclick", "window.returnValue =
document.getElementById('txtValue').value; window.close();")
Button2.Attributes.Add("onclick", "window.close();")
End Sub
I would really appreciate any help on this. I gave it my best shot.
Thanks