Validating RadDateTimePicker for valid dates?

9 posts, 0 answers
  1. Sasha Dossantos
    Sasha Dossantos avatar
    4 posts
    Member since:
    May 2008

    Posted 28 May 2010 Link to this post

    I want to validate a RadDateTimePicker so a value like '4/213/2010 3:45 PM' will make the page invalid. If I manually type this value, I get a little triangle with an exclamation mark inside the textbox and the border turns red. However, when I respond to a button click in javascript and I call
                Page_ClientValidate();
                if (Page_IsValid) {
                 //do stuff
               }
    the Page_IsValid evaluates to true.
    I see no examples in the documentation on RadDateTimePicker and how it works with the ASP .NET validators.

    This is how I define my RadDateTimePicker:
                            <telerik:RadDateTimePicker ID="StartDateTextBox" runat="server" Skin="WebBlue" MaxDate=""
                                Culture="English (United States)" FocusedDate="">
                                <TimePopupButton CssClass="" ImageUrl="" HoverImageUrl=""></TimePopupButton>
                                <TimeView Skin="WebBlue" Interval="00:30:00">
                                </TimeView>
                                <DateInput InvalidStyleDuration="100" runat="server" LabelCssClass="radLabelCss_WebBlue"
                                    Skin="WebBlue" >
                                </DateInput>
                                <Calendar Skin="WebBlue" ShowRowHeaders="False">
                                </Calendar>
                                <DatePopupButton CssClass="" ImageUrl="" HoverImageUrl="" />
                                <ClientEvents OnDateSelected="dateChanged" />
                            </telerik:RadDateTimePicker>

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 31 May 2010 Link to this post

    Hi Sasha,

    Please review the following online example which elaborates on this matter.
    I hope it helps.


    Regards,
    Maria Ilieva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sasha Dossantos
    Sasha Dossantos avatar
    4 posts
    Member since:
    May 2008

    Posted 01 Jun 2010 Link to this post

    I had looked at that link before writing the message board post. I don't see it's relevance to ensuring that the date in a raddatetimepicker is a valid date. It's comparing two times to see if one is before the other, not checking that a date such as 1/2/22010 4:15 AM cannot be submitted via a raddatetimepicker. I used the get_selectedDate method that is used in the link you provided and I get back a null when an invalid date is entered, so I guess I can create a custom validator that calls that method and sets args.IsValid to false if get_SelectedDate returns a null for a raddatetimepicker. Does that sound like a good approach?
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 02 Jun 2010 Link to this post

    Hi,

    Creating Custom Validator in the described way is the best approach for your scenario. Try to implement this approach and let us know if further questions arise.


    Regards,
    Maria Ilieva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. pgodard
    pgodard avatar
    65 posts
    Member since:
    Jul 2006

    Posted 05 Dec 2010 Link to this post

    I followed the example discussed above it works perfectly. However I have my time control on a  grid form template
        <EditFormSettings EditFormType="Template">
    The update continues after the client message for custom validator is displayed. How can I cancel the update from the client side possibly inside the validate() function. Thanks.

    Pierre
  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 08 Dec 2010 Link to this post

    Hello Pierre,

    As the provided information is not enough to correctly understand the issue you are facing and provide proper solution, could you please open a regular support ticket and send us fully runnable sample with exact steps for replicating the problem, Thus we will be able to test it locally and advise you further.


    All the best,
    Maria Ilieva
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  8. Mark Kucera
    Mark Kucera avatar
    84 posts
    Member since:
    Sep 2009

    Posted 23 Mar 2012 Link to this post

    Did you end up implementing this custom validator?  If so could you share your solution?

    Thanks!

    -Mark
  9. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Mar 2012 Link to this post

    Hi,

    Did you review the following online example which elaborates on RadDatePicker validation and shows and option with custom validator.
    If this is not what you need, please elaborate a bit more on your requirements so we could suggest proper approach for your case.

    All the best,

    Maria Ilieva
    the Telerik team

     

    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  10. Mark Kucera
    Mark Kucera avatar
    84 posts
    Member since:
    Sep 2009

    Posted 27 Mar 2012 Link to this post

    I did, thanks and I also found a separate post that had a sample file attached to it that used a  custom validator, and i was able to get that to work.
    Thanks!
    -Mark
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017