Link to home
Start Free TrialLog in
Avatar of Sheritlw
SheritlwFlag for United States of America

asked on

Client Side Set QueryString from Hidden Field

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?

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

Open in new window

Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

what about making onclick event instead of href:
<a onclick=showNewLink(); />

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

For more info on window open, check:
http://msdn.microsoft.com/en-us/library/ms536651(v=vs.85).aspx
Avatar of Sheritlw

ASKER


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

Thanks


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

Open in new window

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:
http://www.daniweb.com/forums/thread26184.html

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.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial