RadDatePicker: How to pass invalid date to server for validation

2 posts, 1 answers
  1. Shubh
    Shubh avatar
    5 posts
    Member since:
    May 2014

    Posted 27 May 2014 Link to this post

    Previous Question

    I am trying to validate date in server side. When I am trying to pass invalid date to my server side code, it is getting converted to {01/01/0001 00:00:00}.

    Works fine when I select proper date.

    Here is my code:

    <telerik:RadDatePicker ID="rdpDob" runat="server" AutoPostBack="true"   DateInput-EmptyMessage="MaxDate" MinDate="01/01/1000"MaxDate="01/01/3000">

    When I try to access the date value:

    It is returning as null.

    Which is quiet strange as I can see my invalid date being passed in the POST request.

    Whats wrong with what I am doing, Is there any property which I need to tweek??


  2. Answer
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 May 2014 in reply to Shubh Link to this post

    Hi Shubh,

    InValidDate will not be available after postback. One suggestion is that you can use the InvalidTextBoxValue  property. Please have a look into the sample code snippet.

    <telerik:RadDatePicker ID="RadDatePicker1" runat="server" MinDate="01/01/2014">
    <telerik:RadButton ID="RadButton1" runat="server" Text="Validate" OnClick="RadButton1_Click">

    protected void RadButton1_Click(object sender, EventArgs e)
        string value=RadDatePicker1.DateInput.InvalidTextBoxValue;
        if (value != string.Empty)
            //your code for validation

  3. DevCraft R3 2016 release webinar banner
Back to Top