not getting new date entered in raddatepicker dateinput

2 posts, 0 answers
  1. Vanika
    Vanika avatar
    1 posts
    Member since:
    Nov 2013

    Posted 21 Nov 2013 Link to this post

    Hi,
    We have a RadDatePicker control. User can enter/edit manually date in the associated date input box. Then on a save button click we need to perform some validation. The problem is when user manually edits the date and presses enter key while still in the date text box, we do not get the selected date from the raddatepicker control. We need this new date value in the validation function. How can we resolve this ?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Nov 2013 Link to this post

    Hi Vanika,

    Please have a look into the following code snippet to get the SelectedDate from the RadDatePicker.

    ASPX:
    <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
    </telerik:RadDatePicker>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Save" AutoPostBack="false"
        OnClientClicked="OnClientClicked1">
    </telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        function OnClientClicked1(sender, args) {
            var datePicker = $find("<%=RadDatePicker1.ClientID %>");
            alert(datePicker.get_selectedDate());
            //Your code for validation
        }
    </script>

    Let me know if you have any concern.
    Thanks,
    Princy.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top