RaddatePicker compare with datetime.now

3 posts, 0 answers
  1. Mohamed El-Sayed
    Mohamed El-Sayed avatar
    33 posts
    Member since:
    Apr 2009

    Posted 05 May 2014 Link to this post

    Dears .

        kindly I need your support as I need to make if statement to compare between raddatepicker and datetime.now if raddatepicker for ex : 22/4/2014
    and datetime.now give alert that it's in old date
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 May 2014 in reply to Mohamed El-Sayed Link to this post

    Hi Beka,

    Please try the following C# code snippet to achieve your scenario.

    C#:
    protected void raddateCompareDate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
    {
        DateTime selectedDate =Convert.ToDateTime(e.NewDate);
        if (selectedDate.Date != DateTime.Now.Date)//checking selected date and current date
        {
            if (selectedDate.Date < DateTime.Now.Date) //if selectedDate date is older than current date alert will show
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Old Date')", true);
        }
    }

    Let me know if you have any concern.
    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mohamed El-Sayed
    Mohamed El-Sayed avatar
    33 posts
    Member since:
    Apr 2009

    Posted 07 May 2014 in reply to Shinu Link to this post

    Thanks Shinu , it's working well
Back to Top