How can I make CalendarExtender StartDate attribute take the current date?

喜你入骨 提交于 2019-12-23 13:16:17

问题


I thought something like this

<ajaxToolkit:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" 
            TargetControlID="txtDatumPoaganje" Format="MM/dd/yyyy" StartDate=<%=DateTime.Now%>>

But it doesnt work. I can make something similar with JavaScript and alert message:

how to disable previous dates in CalendarExtender control through its render event?

but it's not the same.


回答1:


Try SelectedDate instead of StartDate.

Also, the link below says you can't set selecteddate from the html side, instead you must do it from code-behind.

I haven't confirm this however. http://forums.asp.net/t/1293771.aspx/1




回答2:


you can put this in the load page

TextBox2_CalendarExtender.StartDate = DateTime.Now.Date;




回答3:


Assuming you're trying to only show dates from DateTime.Now onwards, this may help you: Disable previous Dates in ajaxToolkit CalendarExtender



来源:https://stackoverflow.com/questions/8863914/how-can-i-make-calendarextender-startdate-attribute-take-the-current-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!