i created one web form

the form contain two label box and text box

in the form one button is placed

i click the button the page redirect to next page

window.location.href="fdfgd.com";

but

i wll send textbox value and label box value in the corresponding redirect page..
pl help me...

hopefully, this will get you going in the right direction.

var tb = document.getElementById('TEXTBOXID');
var tbVal = '';
if(tb !=null)
 tbVal = tb.value;

window.location.href="fdfgd.com?tbVal="+tbVal;
Member Avatar for rkamin1

exactly as campkey said, you can pass the values as part of the query string or you can store it in the session variable.

Why do you even redirect using javascript? :-/
Use code behind to redirect it.

In click event of the button:

Response.Redirect("~/MyPage.aspx?MyQuery=" & Me.MyTextBox.Text.Trim)

Why do you even redirect using javascript? :-/
Use code behind to redirect it.

In click event of the button:

Response.Redirect("~/MyPage.aspx?MyQuery=" & Me.MyTextBox.Text.Trim)

why? Because it saves you a roundtrip and a server call, and is faster and more efficient.

Because it saves you a roundtrip and a server call, and is faster and more efficient.

Well OK, but I don't think he's gonna save much.

why? Because it saves you a roundtrip and a server call, and is faster and more efficient.

Can you please show me this code in C#. I also have the same problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.