Validating a 'HiddenField' control (on ASP 2.0)

E

Eran Dvey-Aharon

Hi NG!

It seems to me that for some reason the validation objects don't know
how to work with controls of type 'HiddenField'.
It doesn't make any sence - because they are actually rendered as
<input type=hidden> on the client side, while regular textboxes that
rendered almost in the same way know how to be validated.

Any idea how to work-around this problem?

Eran Dvey-Aharon
ProSight Inc.
 
G

Guest

I would go to lab.msdn.com and search for a prior bug that has been
filed about this. If you find one validate it and leave a comment (at the
bottom) and if you cannot find it then please post a new bug and then reply
to this tree with a link to it.

There have been multiple positions where Microsoft has decided to not
allow us to use or validate Hidden Input controls and I fail to see why they
continously decide to remove the Hidden fields from databinding and data
validation options.
 
P

Peter Blum

Microsoft's validators only work when they have a webcontrol or Htmlcontrol
object declared and that object uses the ValidationPropertyAttribute. I
suspect that Microsoft engineers are concerned by a couple of things with
hidden fields:

1. Many users declare hidden fields through Page.RegisterHiddenField(). That
does not generate an object on the page. (Without an object, there is no
ValidationPropertyAttribute).
2. You can use a CustomValidator with a hidden field (only do not assign the
fieldID to the ControlToValidate property).

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top