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

Not allow empty, null value to RadDateTimePicker

8 Answers 936 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
qwer
Top achievements
Rank 1
qwer asked on 14 Dec 2010, 05:20 AM
Hi all,
    In my db, one of the date field is nullable, which is used in multiple places.
one of my silverlight (MVVM) screen, I'm using that date as not allow empty/null (required).
So is there any attribute in RadDateTimePicker to set as not allow empty/null as required.

I'm using as follow

<telerik:RadDateTimePicker InputMode="DatePicker"
                                  HorizontalAlignment="Left"
                                  DisplayDateStart="1900-01-01"
                                  SelectedDate="{Binding Path=MemberDOB, Mode=TwoWay,
                                              NotifyOnValidationError=True, ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}"
/>

8 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 14 Dec 2010, 11:25 AM
Hello qwer,

You need to use the SelectedValue instead of the SelectedDate property. Follow the correct code:
<telerik:RadDateTimePicker InputMode="DatePicker"
                                  HorizontalAlignment="Left"
                                  DisplayDateStart="1900-01-01"
                                  SelectedValue="{Binding Path=MemberDOB, Mode=TwoWay,  
                                              NotifyOnValidationError=True, ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" 
/> 

Greetings,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
qwer
Top achievements
Rank 1
answered on 14 Dec 2010, 11:58 PM
I've changed to SelectedValue but control still allow Null/empty
I want it as not allow null/empty/blank. Any advised?
0
Kaloyan
Telerik team
answered on 16 Dec 2010, 09:34 AM
Hello qwer,

In case of null input one of the options is to perform validation. Check our online validation examples showing that kind of approach. Let us know if this is not helping you.

Regards,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
qwer
Top achievements
Rank 1
answered on 04 Jan 2011, 06:55 AM
Hi Kaloyan ,

Thanks for advise and I've put RequireField Validator for my radControl and problem sloved. But In case of Telerik can handle in one control which will be more useful and we don't need to put one more extra (RequireFeildValidator) control.

Anyway Thanks.
0
Kaloyan
Telerik team
answered on 06 Jan 2011, 09:20 AM
Hi qwer,

Thank you for the feedback and the suggestion, We will get it under consideration.

Kind regards,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Chintana
Top achievements
Rank 1
answered on 05 Mar 2011, 01:40 PM

Hi,

In some of your examples on binding you have omitted using the 'Path='. But in some examples, such as the one in this thread, 'Path=' is used. What would be the best practice to use the 'Path=' or not to use the 'Path='

<telerik:RadDateTimePicker InputMode="DatePicker"
                                  HorizontalAlignment="Left"
                                  DisplayDateStart="1900-01-01"
                                  SelectedDate="{Binding Path=MemberDOB, Mode=TwoWay,
                                              NotifyOnValidationError=True, ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}"
/>

Or

<telerik:RadDateTimePicker InputMode="DatePicker"
                                  HorizontalAlignment="Left"
                                  DisplayDateStart="1900-01-01"
                                  SelectedDate="{Binding MemberDOB, Mode=TwoWay,
                                              NotifyOnValidationError=True, ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}"
/>

Cheers
0
Kaloyan
Telerik team
answered on 07 Mar 2011, 09:56 AM
Hello Chintana,

There is no need to set a "Path" when you are setting the binding source property right after the "Binding" :

SelectedDate="{Binding Path=MemberDOB, Mode=TwoWay, Source={some source}}

This comes by the fact that the binding class has a constructor with a path parameter. In all other cases you have to put a Path word before the source/target property.

A side note: Use the SelectedValue property instead the SelectedDate.

Best wishes,

Kaloyan
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Chintana
Top achievements
Rank 1
answered on 07 Mar 2011, 01:43 PM
Hi Kaloyan

Thank you very much for explaning this

Cheers
Tags
DateTimePicker
Asked by
qwer
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
qwer
Top achievements
Rank 1
Chintana
Top achievements
Rank 1
Share this question
or