473,569 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validating a 'HiddenField' control (on ASP 2.0)

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.
Nov 19 '05 #1
2 4872
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.

"Eran Dvey-Aharon" <er**@prosight. com> wrote in message
news:ce******** *************** ***@posting.goo gle.com...
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.

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

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

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

<jo*****@driver .net> wrote in message
news:eO******** ******@TK2MSFTN GP15.phx.gbl...
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.

"Eran Dvey-Aharon" <er**@prosight. com> wrote in message
news:ce******** *************** ***@posting.goo gle.com...
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.


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
5782
by: Alex Bink | last post by:
Hi, I have a validating event on a textbox in which I want to prevent the user to leave the textbox without entering the right data. Only if he clicks on another specific control he is allowed to leave the textbox without entering the right information. Is there a way to determine which other control was clicked in the validating event of...
2
2113
by: Chris Dunaway | last post by:
I have a form with a textbox and numerous panels, buttons and other controls. I have handled the textbox Validating and Validated events. The textbox will hold a filename. In the validating event, I check that the string in the textbox is a file that exists or whether or not the string is blank and display a message box in either case. I...
9
4660
by: Kevin Blount | last post by:
Here's the code I tried, and found it failed... <form runat="server" method="post" name="CreditCardForm" id="CreditCardForm"> <% foreach (object item in Request.Form) { if (item.ToString().IndexOf("__") != 0) { //Response.Write(item + " = " + Request.Form +
3
1962
by: sklett | last post by:
I've added a HiddenField control to my page and some javascript to show it's value in an alert box when a button is pressed. The value that is displayed in the alert box is correct, but when I post the form the value for the HiddenField control is empty. I'm pretty new to ASP.net so I'm not really sure what could cause this. I'm using...
3
6846
by: Jeff | last post by:
Hey ASP.NET 2.0 Below you see the code I'm having problem with. In the Open_Message event/method I want to get the value of the HiddenField at the row in the repeater control I clicked.... my goal is to get the id (not a control Id, but an id related to a database record) of a row in the repeater control. I don't want to use Get... I've...
1
1485
by: Milkstr | last post by:
I have a repeating region with a hiddenfield on each line, i want to start a counter in my reapeating reagion so that the hiddenfield becomes unique on each line. So that is the reapeating region goe to say 10 records i actually have 10 hiddenfields with unique names. I thought i could just set a variable at the start of the loop that increments...
1
3434
by: RSH | last post by:
I have a situation where I have a user control (Called TopOrangeMenu) that has an Hidden HTML Field called "txtU" I am trying to get at the value of that hidden field control from within the User Control. Hidden Field Control as it apears in the HTML of the User Control: <INPUT id="txtU" type="hidden" runat="server"> Trace Output...
5
2396
by: hharry | last post by:
Hello All, I am trying to make use the HiddenField server control to make a server-side variable visible to a client script. I set the value of the HiddenField inside of the Page_Load event. protected void Page_Load(object sender, EventArgs e) { this.myHiddenField.Value = myVar; }
7
11499
by: imbirek8 | last post by:
Hi! I would like to write something in Javascript to HiddenField: <asp:HiddenField ID="hiddenMy" runat="server" Value="" /> And in the code behind read this value. But this HiddenField is in user control. I use this control in many pages and in every page this field has different value.. I don't know why, but it's error when I do: var ...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.