By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,812 Members | 875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,812 IT Pros & Developers. It's quick & easy.

Forms and hidden fields

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.