rad date picker should load start date of current month automatically, when Page loads in asp.net

1.2k Views Asked by At

current month current year and start date(1 to be constant) in telerik rad date picker Am working to get date 1= year,6 months back, 1 date2=year, current month, 1

i can get current date as below

    startdatepicker.SelectedDate = DateTime.Now;
//startdatepicker.SelectedDate = new DateTime(DateTime.Now.Year, DateTime.Now.AddMonths(-6), 1);//-->this not working
2

There are 2 best solutions below

0
On BEST ANSWER

I got it by:

DateTime end = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
enddate.SelectedDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

start.SelectedDate = (end.AddMonths(-6));
9
On

This should work, unless I misunderstand your question...

startdatepicker.SelectedDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);