当页面在 asp.net 中加载时,rad 日期选择器应该自动加载当月的开始日期

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

当前月份 今年 和 telerik rad 日期选择器中的开始日期(1 保持不变) 我正在努力获取日期 1= year,6 months back, 1 date2=年,当前月份,1

我可以得到当前日期如下

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

这应该可行,除非我误解了你的问题...

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

我通过以下方式获得它:

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));