This is a migrated thread and some comments may be shown as answers.

Bug with RadDateTimePicker and conditional validation?

1 Answer 84 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Myles
Top achievements
Rank 1
Myles asked on 11 May 2012, 10:26 AM
Hi,

I am using the RadDateTimePicker on a custom appointment form.  I am using the IDataErrorInfo interface on my custom appointment object in order to handle validation of fields.  The data object field bound to the RadDateTimePicker control has the following validation method:

 

private string ValidateLorryHoldingAreaArrivalDate()  

{  

if ((!this.LorryHoldingAreaArrivalDate.HasValue) && (PlanType != PlanType.None) && (LorryHoldingAreaID.HasValue))  

{  

    return "A lorry holding area arrival date is required!"

}

  

return null;

 

}

From this code we can see that the validation is conditional and depends on other field values.
The other fields that can alter the conditional validation result for the control are also firing the necessary PropertyChanged events e.g. 

 

private Int32? _lorryHoldingAreaID;  

public Int32? LorryHoldingAreaID  

get  

{  

    return Storage<Movement>()._lorryHoldingAreaID;  

set 

{

var storage = Storage<Movement>();

if (storage._lorryHoldingAreaID != value)  

{

    storage._lorryHoldingAreaID = value;  

    OnPropertyChanged(() => LorryHoldingAreaID);

    OnPropertyChanged(() => LorryHoldingAreaArrivalDate); //required to reevaluate the validation

}

}

}

  

My problem is this.  The red border does not appear on the RadDateTimePicker control when the validation method above fires and returns an error sting.  The XAML for my RadDateTimePicker control is as follows: 

 

<telerik:RadDateTimePicker 

Grid.Row="6"

Grid.Column="3"

telerik:StyleManager.Theme="{StaticResource Theme}"

Margin="3"

SelectedValue="{Binding DialogViewModel.Occurrence.Appointment.LorryHoldingAreaArrivalDate, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}">

</telerik:RadDateTimePicker>

  

Any ideas why the red border isn't dynamically appearing when the underlying validation result changes to a failure state?

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 17 May 2012, 09:09 AM
Hello Myles,

I've tried to reproduce this issue in a simple project but without much success. You can find it attached to this thread. Can you please try it and let us know what is different in your case? Thanks

Regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ScheduleView
Asked by
Myles
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or