Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Paramaters Help.

Status
Not open for further replies.

mtl77

Programmer
May 27, 2003
31
CA
Hi All,

I am trying to pass a parameter (an int) from one form to another which opens in a pop up window. I am wondering if there is any way to open the pop-up window from the code behind page rather then using the Window.open() with java script in the html. I am having a hard time openeing the popup and passing the parameter to it, any ideas?

Thanks
Kevin.
 
To the extent of my knowledge, no you cannot open a window from server side because it runs on the server - not the client. I have used this same kind of functionality in the past. I found that an easy workaround (I don't know if you'd necessarily call it a "hack" - not really properly "engineered"), but right in your .aspx page (not the code behind), you could do something like this:

<script language=JavaScript>

function PopUp()
{
window.open('pagename.aspx?param=<%=param_var%>','','');
}

</script>

This will append your parameter to the URL in the popup window. From your popup page, you can then handle the parameter in whatever manner you would like.

Hope that helps =D

-----------------------------------------------
&quot;The night sky over the planet Krikkit is the least interesting sight in the entire universe.&quot;
-Hitch Hiker's Guide To The Galaxy
 
See the code below

private sub TransferData()

dim n as string=&quot;John&quot;
dim a as string=&quot;123 main st&quot;

Response.Write(&quot;<script language=javascript> window.open('WhlFacilityList.aspx?Name= &quot; + n+ &quot; &Address= &quot; + a+ &quot;', 'Facilities','toolbar=no,location=no,menubar=no,resizable=yes,scrollbars=yes');&quot; </script>&quot;)

end sub

Hope this Helps

Sam

 
If you place a Hyperlink on your page and set the Target to Something like New and then set the NavigateUrl you can pass a parameter to use in that page. In the case I have included I am passing the start and end dates.

Me.hlnkSummary.NavigateUrl = &quot;LeaveDaySummary.aspx?DateRange=&quot; & Format(calStartingDate.SelectedDate, &quot;MM/dd/yyyy&quot;) & Format(CalEndingDate.SelectedDate, &quot;MM/dd/yyyy&quot;)

Hope this helps,

Jennifer

Hope everyone is having a great day!

Thanks - Jennifer
 
I have a couple of responses to the above valuable tips.
1. I like AtomicChips java code but how do I get the value of a textbox that the user enters to be the value of param_var. If I use
<code>
window.open('pagename.aspx?param=<%=txtparm.text%>' ,'','');
</code>
I just send the 'txtparm.text' string.
2. The suggestion by claws2rip worked after I took the double quote mark out from before the </script> tag.
The problem is that it displays two new windows

Oakgrove Computer Grouper
Lansing, MI
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top