Client Side Set QueryString from Hidden Field

Posted on 2011-03-01
Last Modified: 2012-08-14
Hi EE,

I have an href control in my aspx code.  I want to redirect with a querystring to another page.
The querystring needs to be developed from an hidden field on the form.
How do I do this?

<a href='<%# "Portfolio.aspx?StylistID="+StylistID.Value %>' />

Open in new window

Question by:Sheritlw
  • 3
  • 2
LVL 35

Expert Comment

by:Miguel Oz
ID: 35011891
what about making onclick event instead of href:
<a onclick=showNewLink(); />

function showNewLink()
{'Portfolio.aspx?StylistID='+StylistID.Value , '_blank', 'height=200,width=400,status=yes,resizable=yes');

For more info on window open, check:

Author Comment

ID: 35011931

I would rather use client side.
I've already tried response.redirect on the server also, but it didn't work.


Response.Redirect("Portfolio.aspx?StylistID=" & Me.StylistID.Value & "")

Open in new window

LVL 35

Expert Comment

by:Miguel Oz
ID: 35013893
My solution is client side (javascript) and it is opening a new window.
If you need to open the link in the same window, the javascript method should be:
function showNewLink()
  window.location = "Portfolio.aspx?StylistID="+StylistID.Value;

Note: In your server code, have you checked that the StylistID.Value is assigned in the client code only?
For more info in hidden value usage, check:


Author Comment

ID: 35014009
I've checked that there is a value in hidden field.
I'm not sure what you mean by window.location??
I just want to open another page.  In the page load of the page I want to open, I request the query string.
When I walk through the code, Response.Redirect("Portfolio.aspx?StylistID=" & Me.StylistID.Value & "")
I get the error Operator '==' incompatible with operand types 'Int32' and 'Object' before the page load fires on the page I want to open.

LVL 35

Accepted Solution

Miguel Oz earned 500 total points
ID: 35048240
For comment 1:
The code posted is javascript code: (You have to add that to your web site, see

function showNewLink()
  window.location.href = "Portfolio.aspx?StylistID="+StylistID.Value;

For   window.location.href explanation, check:

For comment 2:
Response.Redirect("Portfolio.aspx?StylistID=" & Me.StylistID.Value)
also put a breakpoint and tell me what Me.StylistID.Value has been set.


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Code works but how can I download the file? 20 67
Get Reply from SSIS to intranet site when finished 3 33
Error on Add method 1 37
Replace &lt; with < 14 55
User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now