Passing value in window.open

passing values with url

alert(document.Form1.pid.value )
window.open(‘test.aspx?id=" + document.Form1.pid.value ‘,’’,‘scrollbars=yes,resizable=yes,width=800,height=400’);

i have made this function and want to pass value.

in test page i use

x= request.querystring(“id”).ToString.Trim
but in alert i do getthe value
i am not getting any value

The querystring in JavaScript just contains everything after the ?

You have to split it up yourself.

hey can u please explain a bit more in depth couldn get u?

toString and trim require parenthesis to invoke those methods.

You may want to post the actual script code that you’re using on the test page.

in page1.aspx

<script type=“text/javascript”>
function opn()
{
alert(document.Form1.pid.value)
window.open(‘test.aspx?id=" + document.Form1.pid.value ‘,’’,‘scrollbars=yes,resizable=yes,width=800,height=400’);

}
&lt;/script&gt;

<a href=“#” onclick=“opn();”>View</a>

in test.aspx in code behind
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim test1 = Request.QueryString("id").ToString.Trim

msgbox(test1)
End sub

The javascript code to open the new window looks like it’s ding with it should be going correctly.
The code behind is asp and is using visual basic to work with the querystring.

I suggest that you may find people on our Classic ASP forum who can provide answers about handling the querystring from as it relates to asp and visual basic.

window.open(“test.aspx?rowid=”+ value1 ,‘’,‘scrollbars=no,resizable=yes,width=800,height=500’);
this is working fine. i do get the values

i want to pass one more paramater with a fixed value
window.open(“test.aspx?rowid=”+ value1 +rule=one ,‘’,‘scrollbars=no,resizable=yes,width=800,height=500’);

When you pass multiple values, you need to separate them with the & symbol

window.open(“test.aspx?rowid=”+ value1 + “& mode=” + ‘data2’,‘’,‘scrollbars=no,resizable=yes,width=800,height=500’);

when i request i get the value of mode as blank , first value i am getting roper

You have a space after the ampersand. It should be:

“test.aspx?rowid=” + value1 + “&mode=” + value2

I would even go so far as to URL encode the values:

“test.aspx?rowid=” + encodeUriComponent(value1) + “&mode=” + encodeUriComponent(value2)

thnaks

got it