4

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.

Community
  • 1
  • 1
Filip
  • 397
  • 1
  • 5
  • 14

3 Answers3

3

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

user1231231412
  • 1,659
  • 2
  • 26
  • 42
  • Sorry it seems like my question was stupid :) i can make the changes in the *.cs file if(!IsPostBack) extBox1_CalendarExtender.StartDate = DateTime.Now; – Filip Jan 14 '12 at 17:58
  • @Filip Not stupid at all. Sometimes you're in the code so far it's hard to step back at times. – user1231231412 Jan 14 '12 at 19:21
2

you can put this in the load page

TextBox2_CalendarExtender.StartDate = DateTime.Now.Date;

laaposto
  • 11,835
  • 15
  • 54
  • 71
0

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

Community
  • 1
  • 1
Brissles
  • 3,833
  • 23
  • 31