gambrinus
asked on
ASP.NET C# Hyperlink passing values back to parent form
Hi there...
Been pulling my hair out over this and I am obviously missing something simple and need another pair of eyes... so please help... :-)
I have a simple form that looks like this:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859 -1" %>
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
btnAddressFinder.Attribute s.Add("onc lick", "window.open('address-find er.aspx? txtAddressFinder=test','po pup','widt h=250,heig ht=250,lef t=270,top= 180');");
}
</script>
<html>
<title></title>
</head>
<form id="Form1" method="post" runat="server">
<table width="742">
<tr>
<td width="20"> </td>
<td>
<h1>Postal Address</h1>
<table width="100%" border="0">
<tr>
<td width="30%"><p><strong>Tit le</strong ></p></td>
<td width="70%"><asp:dropdownl ist AutoPostBack="false" ID="ddTitle" runat="server"></asp:dropd ownlist></ td>
</tr>
<tr>
<td width="30%"><p><strong>Fir st name</strong></p></td>
<td width="70%"><asp:textbox ID="txtFirstName" runat="server" TextMode="SingleLine" /></td>
</tr>
<tr>
<td width="30%"><p><strong>Sur name</stro ng></p></t d>
<td width="70%"><asp:textbox ID="txtSurname" runat="server" TextMode="SingleLine" /></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><p><strong>Ple ase enter your postcode in the textbox
below and click "Address Finder" to let us complete
your address details for you.</strong></p></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="30%"> </td>
<td width="70%">
<asp:textbox ID="txtAddressFinder" runat="server" TextMode="SingleLine" />
<asp:button ID="btnAddressFinder" Text="Address Finder" runat="server"/></td>
</tr>
</table>
</form>
</body>
</html>
The address finder popup is working fine... and the address finder popup looks like this:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859 -1" %>
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
HyperLink1.NavigateUrl = "javascript:;";
HyperLink1.Attributes.Add( "onclick", "window.opener.document.fo rms(0).txt AddressFin der.value= '2222';sel f.close()" );
}
</script>
<html>
<head>
<title>Postal Address Finder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form runat="server">
<asp:hyperlink runat="server" ID="HyperLink1" ToolTip="Hyperlink">Hyperl ink</asp:h yperlink>
</form>
</body>
</html>
The problem I am having is that when I click on the link nothing happens? If I remove the part of the script to post the value back to the form - and just leave the self.close() - it works fine and the popup closes?
Can anyone see what I am doing wrong here?
Thanks for the help!
g|a|m|b|r|i|n|u|s
Been pulling my hair out over this and I am obviously missing something simple and need another pair of eyes... so please help... :-)
I have a simple form that looks like this:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
btnAddressFinder.Attribute
}
</script>
<html>
<title></title>
</head>
<form id="Form1" method="post" runat="server">
<table width="742">
<tr>
<td width="20"> </td>
<td>
<h1>Postal Address</h1>
<table width="100%" border="0">
<tr>
<td width="30%"><p><strong>Tit
<td width="70%"><asp:dropdownl
</tr>
<tr>
<td width="30%"><p><strong>Fir
<td width="70%"><asp:textbox ID="txtFirstName" runat="server" TextMode="SingleLine" /></td>
</tr>
<tr>
<td width="30%"><p><strong>Sur
<td width="70%"><asp:textbox ID="txtSurname" runat="server" TextMode="SingleLine" /></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><p><strong>Ple
below and click "Address Finder" to let us complete
your address details for you.</strong></p></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="30%"> </td>
<td width="70%">
<asp:textbox ID="txtAddressFinder" runat="server" TextMode="SingleLine" />
<asp:button ID="btnAddressFinder" Text="Address Finder" runat="server"/></td>
</tr>
</table>
</form>
</body>
</html>
The address finder popup is working fine... and the address finder popup looks like this:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859
<script runat="server">
protected void Page_Load(Object Src, EventArgs E)
{
HyperLink1.NavigateUrl = "javascript:;";
HyperLink1.Attributes.Add(
}
</script>
<html>
<head>
<title>Postal Address Finder</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form runat="server">
<asp:hyperlink runat="server" ID="HyperLink1" ToolTip="Hyperlink">Hyperl
</form>
</body>
</html>
The problem I am having is that when I click on the link nothing happens? If I remove the part of the script to post the value back to the form - and just leave the self.close() - it works fine and the popup closes?
Can anyone see what I am doing wrong here?
Thanks for the help!
g|a|m|b|r|i|n|u|s
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.