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

Filip picture Filip · Jan 14, 2012 · Viewed 21.5k times · Source

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.

Answer

user1231231412 picture user1231231412 · Jan 14, 2012

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