change raddatetimepicker values in code behind

2 posts, 0 answers
  1. sf
    sf avatar
    103 posts
    Member since:
    Apr 2009

    Posted 19 Apr 2011 Link to this post

    on a button click "btn1_Click" event on server side, i want to change the time value in the raddatetimepicker to a new time value.
    Is this possible?

    thanks in advance
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Apr 2011 Link to this post

    Hello Sf,

    Try the following approach to achieve your requirement.
    <telerik:RadDateTimePicker ID="DateTimePicker1" SelectedDate="12/12/2011" runat="server">
    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    protected void Button1_Click(object sender, EventArgs e)
          DateTime selectedTime=new DateTime();
          DateTime time = new DateTime((int)selectedTime.Year, (int)selectedTime.Month, (int)selectedTime.Day, 12, 12, 12);
          DateTimePicker1.SelectedDate = time;

Back to Top