RadDateTimePicker to DateTime value in asp.net

Thread is closed for posting
3 posts, 0 answers
  1. xeon
    xeon avatar
    2 posts
    Member since:
    Jun 2015

    Posted 13 Jun 2015 Link to this post

    Platform :: ASP.NET

    Editor ::     VS 2013

    I am trying to pass the value of RadDateTimePicker to a function as DateTime value in my code behind file. but it is showing error?

    1. How to pass RadDateTimePicker as DateTime value?

    2. how to validate the value of RadDateTimePicker is greater then the current system datetime value?

    while trying to pass RadDateTimePicker as DateTime value,


      <telerik:RadDateTimePicker runat="server" ID="regDate" >
               <Calendar ID="Calendar1" runat="server" EnableKeyboardNavigation="true">

    // code behind logic

    DateTime getRegDate = regDate;


    shows error ::

    can not implicitly convert type 'Telerik.Web.UI.RadDateTimePicker' to 'System.Date.Time' 




  2. Viktor Tachev
    Viktor Tachev avatar
    2495 posts

    Posted 15 Jun 2015 Link to this post

    Hi Arnab,

    In order to access the selected date from a RadDateTimePicker control you should use the SelectedDate property. Note that it returns a nullable type.

    The following code snippet illustrates how you can get the selected date and time in the code-behind.


    <telerik:RadDateTimePicker runat="server" ID="RadDateTimePicer1"></telerik:RadDateTimePicker>
    <asp:Button ID="Button1" Text="Get selected DateTime" runat="server" OnClick="Button1_Click" />


    protected void Button1_Click(object sender, EventArgs e)
        DateTime? selectedDateTime = RadDateTimePicer1.SelectedDate;

    Viktor Tachev
    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 Feedback Portal and vote to affect the priority of the items
  3. Hadoop
    Hadoop avatar
    8 posts
    Member since:
    Jun 2015

    Posted 17 Jun 2015 in reply to Viktor Tachev Link to this post

    thanks for the reply!!!
Back to Top