Telerik RadDatePicker Validation

Topics: Developer Forum
Apr 23, 2007 at 11:42 AM
Hi Simon,

For some reason when i have a validation association wired to an instance of a Telerik RadDatePicker, on form submit i get two copies of the error message shown at the UI (after a postback).

So i have:

DateTime is required. DateTime is required.

Is this something that you are aware of? It doesn't seem to happen for standard textbox controls.

Additionally, after a postback, it looks like the JS is then wired up to show error messages which prevents form postbacks (until a valid submission is entered), but the problem is that the JS adds error messages to the controls where there are already (postback generated) error messages from the previous submission. i guess i have 2 seperate issues really.

Are you able to help?

Many Thanks,

May 4, 2007 at 1:43 PM
Resolved through email.
The problem was not generating the validators in the page load .
Jun 7, 2007 at 3:33 PM
Hi Simon,

Following some development, the 2nd part to the original question is still outstanding.

To start with, when a form loads for the Date control, an invalid form submission will actually post back, rather than rendering a javascript displayed validation message. The validation message is then shown via the server side when the form loads again.

If the subsequent form submission is still invalid, a further validation message is shown after the original (server generated one) but this time without a postback, using JavaScript.

This is a bit weird!


Jun 12, 2007 at 12:10 AM
OK You have me confused.
Can you send me some code that illustrates the problem?

Perhaps a zipped sample web application?
Jan 23, 2008 at 2:21 PM
Hi Simon,

This is still an annoying issue - it is not particularly easy for me to produce a sample app because the setup is quite complex, but i will try if it is required.

My problem is this:

1. User navigates to my .NET page which contains my custom DetailsView control set to insert mode, databound using an ObjectDataSource against my Validation framework decorated class instance.
2. User clicks the OK button without completing required or validation decorated fields
3. Page posts back, where the server side code calls the Validate() method which re-presents the user with the page, but this time with server generated validation error messages under each appropriate incomplete field.
4. User clicks the OK button again without completing required or validation decorated fields
5. A postback does not occur, this time JavaScript validation on the client side kicks in and adds a further error message after the original server generated one, in the appropriate place, so it looks like this "Field is required. Field is required."

It looks like the inital postback which calls the server validate method is what then causes the JavaScript to work the second time round.

This was a liveable problem until i have file upload controls on the page, which means that files get posted to the server the first time round even on invalid form submissions, which wastes client time.

As a side in the OnInit event i declare my validator control like this:

validator = new PropertyValidatorGeneratorControl();
validator.ID = "Validator";
validator.Display = ValidatorDisplay.Dynamic;
validator.Mode = Mode.ClientServer;
validator.TargetObjectRequired += new EventHandler<TargetObjectRequiredEventArgs>(validator_TargetObjectRequired);

I add the validator associations in two events, OnLoad and OnDataBound in the custom DetailsView control, but before the associations are added i only call the method if the associations.count is equal to zero.

I am using 1.10 of the code base.



Feb 1, 2008 at 1:55 AM
Sorry for the delayed reply.
Unfortunately JavaScript problems are really hard to diagnose if I cannot reproduce it on my side. If you could whip up a test application that illustrates your problem that would be make looking into the problem much easier.