Validating a 'HiddenField' control (on ASP 2.0)

  • Thread starter Thread starter Eran Dvey-Aharon
  • Start date Start date
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.
 
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.
 
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
 
Back
Top