Passing value to a popup window???
-
Ok, I am Poping up a window, but i want to pass it a value from the opener window. How would i go about doing that? Here is how i am opening the new window. Dim myScript As String = "window.open('datafilter.aspx') </" + "script>" Sub button1_Click(sender As Object, e As EventArgs) Page.RegisterStartupScript("OpenWindowScript", myScript) end sub Thank you, Santana </x-turndown>
-
Ok, I am Poping up a window, but i want to pass it a value from the opener window. How would i go about doing that? Here is how i am opening the new window. Dim myScript As String = "window.open('datafilter.aspx') </" + "script>" Sub button1_Click(sender As Object, e As EventArgs) Page.RegisterStartupScript("OpenWindowScript", myScript) end sub Thank you, Santana </x-turndown>
The simplest way that comes to mind would be to use a query string for the window URL. For example:
string script = "<script language=\"javascript\">window.open('datafilter.aspx**?param1=blue¶m2=green**')";
[Bold and italics added to querystring for emphasis.] If the parameters are unknown at rendering time, you can simply modify the client script to use a variable for the query string, and add a client side handler to populate that variable. Of course, this isn't secure... so if the parameters are sensitive in nature, I wouldn't recommend this approach. The more complex way that occurs to me is to manipulate the new window using the handle that javascript returns when you open it. If you choose to go that route, try googling for "javascript and new window". There are numerious examples explained far better then I could. Hope that helps a bit. :) --Jesse
-
Ok, I am Poping up a window, but i want to pass it a value from the opener window. How would i go about doing that? Here is how i am opening the new window. Dim myScript As String = "window.open('datafilter.aspx') </" + "script>" Sub button1_Click(sender As Object, e As EventArgs) Page.RegisterStartupScript("OpenWindowScript", myScript) end sub Thank you, Santana </x-turndown>
Dim myScript As String = "window.open('datafilter.aspx<pre>?Parameter=MyParameter')</pre> </code> You can pass them as a normal page. </x-turndown>