steva
asked on
Setting a HiddenField value from a QueryString
I've declared a hidden field that I'd like to set to the value of a QueryString parameter. The obvious way to do this would be with something like:
<asp:HiddenField ID="hardwareid" runat="server" value=<%Request.QueryStrin g("hardwar e_id")%> />
but this doesn't work. I can do it by leaving the value out on the aspx page and setting it on the vb page:
hardwareid.Value = Request.QueryString("hardw are_id")
But it seems like there ought to be a way to reference the QueryString directly on the aspx page. Am I missing something?
Thanks
<asp:HiddenField ID="hardwareid" runat="server" value=<%Request.QueryStrin
but this doesn't work. I can do it by leaving the value out on the aspx page and setting it on the vb page:
hardwareid.Value = Request.QueryString("hardw
But it seems like there ought to be a way to reference the QueryString directly on the aspx page. Am I missing something?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sami:
Tried the <%#..%> in your reference, but it didn't work.
<asp:HiddenField ID="hardware_id" runat="server" Value=<%#Request.QueryStri ng("hardwa re_id")%> />
rkworlds:
'<%= Request.QueryString("hardw are_id")%> ' didn't work for me. I believe it's assigning the entire string as the value rather than executing the Request.QueryString inside the string.
I notice in your reference that they do what I did to assign the hidden value: assign it on the vb page.
Maybe there is no better way.
Tried the <%#..%> in your reference, but it didn't work.
<asp:HiddenField ID="hardware_id" runat="server" Value=<%#Request.QueryStri
rkworlds:
'<%= Request.QueryString("hardw
I notice in your reference that they do what I did to assign the hidden value: assign it on the vb page.
Maybe there is no better way.
thats correct. You cannot access that directly in .aspx.
The link provided was to show how you can reference a property from code-behind in .aspx.
So say you had a property set to Request.QueryString("hardw are_id") in your code-behind then you can access it like:
value='<%# yourproperty %>'
The link provided was to show how you can reference a property from code-behind in .aspx.
So say you had a property set to Request.QueryString("hardw
value='<%# yourproperty %>'
ASKER
Ok.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
"but why do you want to do it in the aspx page"
Excellent question! I just want to learn as much as I can while doing this page. It seems like there should be a way to do it from the aspx page and if there is I'd like to know what it is. But I'm getting the impression that there isn't a way, and that's fine. Now I know.
Thanks to everyone for offering your ideas. I split the points.
Excellent question! I just want to learn as much as I can while doing this page. It seems like there should be a way to do it from the aspx page and if there is I'd like to know what it is. But I'm getting the impression that there isn't a way, and that's fine. Now I know.
Thanks to everyone for offering your ideas. I split the points.
<asp:HiddenField ID="hardwareid" runat="server" value= '<%Request.QueryString("ha