469,572 Members | 1,213 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

Forms and hidden fields

Hi,

Are hidden fields passed in the querystring when a form is posted back?
If they are, must the hidden fields be server controls in order to
access them from .net code?

Thanks,
Roshawn
Nov 19 '05 #1
5 1996
No, they are passed in a form post which is different from a query string
(but has a similar effect)

AFAIK you can access them directly as Request["myHiddenField"] or
Request.Form["myHiddenField"]

but if you want to access them as server controls you can do that as well,
just declare them in the usual way:

<input type="hidden" runat="server" id="myHiddenField" name="myHiddenField"
value="xyz">

I always make the ID and Name the same in this case - it's not strictly
necessary but a lot less confusing.

"Roshawn Dawson" <ud****@bellsouth.net> wrote in message
news:uZ*************@TK2MSFTNGP15.phx.gbl...
Hi,

Are hidden fields passed in the querystring when a form is posted back? If
they are, must the hidden fields be server controls in order to access
them from .net code?

Thanks,
Roshawn

Nov 19 '05 #2
Roshawn Dawson wrote:
Hi,

Are hidden fields passed in the querystring when a form is posted back?
If they are, must the hidden fields be server controls in order to
access them from .net code?

Thanks,
Roshawn


no..not in the QueryString but if the input is of type=hidden then yes
they are passed.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #3
Thanks guys for your prompt responses.

It seems that one of you says that hidden fields are not passed in the
querystring while the other says the opposite. Perhaps I wasn't clear
enough.

What I mean by hidden fields is hidden form fields. You know, the input
fields whose type is specified as hidden, like this:

<input type="hidden" name="227" id="227" value="stuff that is hidden" />

Are such fields included in the querystring or not?

Thanks,
Roshawn

Curt_C [MVP] wrote:
Roshawn Dawson wrote:
Hi,

Are hidden fields passed in the querystring when a form is posted
back? If they are, must the hidden fields be server controls in order
to access them from .net code?

Thanks,
Roshawn

no..not in the QueryString but if the input is of type=hidden then yes
they are passed.

Nov 19 '05 #4
Hi,

If you are using method="post" in your form element, the hidden fields will
be sent in the Request Collection when you submit the form.

If you are using the method="get", it will be sent in the query string

--
Saravanan K V
"Roshawn Dawson" wrote:
Thanks guys for your prompt responses.

It seems that one of you says that hidden fields are not passed in the
querystring while the other says the opposite. Perhaps I wasn't clear
enough.

What I mean by hidden fields is hidden form fields. You know, the input
fields whose type is specified as hidden, like this:

<input type="hidden" name="227" id="227" value="stuff that is hidden" />

Are such fields included in the querystring or not?

Thanks,
Roshawn

Curt_C [MVP] wrote:
Roshawn Dawson wrote:
Hi,

Are hidden fields passed in the querystring when a form is posted
back? If they are, must the hidden fields be server controls in order
to access them from .net code?

Thanks,
Roshawn

no..not in the QueryString but if the input is of type=hidden then yes
they are passed.

Nov 19 '05 #5
Thank you. Now I understand. :-)

Roshawn

Saravanan K V wrote:
Hi,

If you are using method="post" in your form element, the hidden fields will
be sent in the Request Collection when you submit the form.

If you are using the method="get", it will be sent in the query string

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by petersk | last post: by
6 posts views Thread by Manny Chohan | last post: by
3 posts views Thread by Jerim79 | last post: by
7 posts views Thread by thersitz | last post: by
6 posts views Thread by Graham | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.