Item Repeater command invokes validation

It seems I have a bit of an error, I have an ASP.NET repeater with link buttons in it, and the link button has a validations property set to false.

Nonetheless; when you click on it, which makes the panel visible on the web page, the required asp.net field validation element controls the trigger and displays its error messages. On those controls on which I have validator validation elements.

Any ideas as to what might make it ignore the cause check property set to false?

+4
source share
3 answers

In my opinion, you should set different ValidationGroup property values ​​for repeater control and for control, which is the source of the required validation field. Perhaps the container for re-management raised an event that can be repaired using the required validation field.

If the above does not help, try disabling client validation for RequiredFieldValidator using EnableClientScript="False" for this. And activate RequiredFieldValidator when it is really useful. For example, in the event handler of some buttons, you can apply the following code:

 MyButton.Validate(); if (MyButton.IsValid) { Do what you want... } 
+1
source

try to set the panel visibility to true all the time in viewing mode and check the confirmation again.

0
source

For everyone who has this problem and stumbles upon this post, here is what I found.

It turns out the problem arose because I had EnableViewState = "false" set to Repeater. This somehow violated the random postback of the event and made each validator on the page fire. All I needed to do was manually call DataBind () on Repeater from inside Page_Load (), and it cleared.

0
source

Source: https://habr.com/ru/post/1336944/


All Articles