Not allow empty, null value to RadDateTimePicker

9 posts, 0 answers
  1. qwer
    qwer avatar
    18 posts
    Member since:
    Oct 2010

    Posted 13 Dec 2010 Link to this post

    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}"
    />
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 14 Dec 2010 Link to this post

    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
  3. DevCraft banner
  4. qwer
    qwer avatar
    18 posts
    Member since:
    Oct 2010

    Posted 14 Dec 2010 Link to this post

    I've changed to SelectedValue but control still allow Null/empty
    I want it as not allow null/empty/blank. Any advised?
  5. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 16 Dec 2010 Link to this post

    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
  6. qwer
    qwer avatar
    18 posts
    Member since:
    Oct 2010

    Posted 04 Jan 2011 Link to this post

    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.
  7. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 06 Jan 2011 Link to this post

    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
  8. Chintana
    Chintana avatar
    13 posts
    Member since:
    Jul 2010

    Posted 05 Mar 2011 Link to this post

    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
  9. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 07 Mar 2011 Link to this post

    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!
  10. Chintana
    Chintana avatar
    13 posts
    Member since:
    Jul 2010

    Posted 07 Mar 2011 Link to this post

    Hi Kaloyan

    Thank you very much for explaning this

    Cheers
Back to Top
DevCraft banner