Filip
Filip

Reputation: 396

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

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.

Upvotes: 4

Views: 23042

Answers (3)

user3578442
user3578442

Reputation: 21

you can put this in the load page

TextBox2_CalendarExtender.StartDate = DateTime.Now.Date;

Upvotes: 2

Brissles
Brissles

Reputation: 3881

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

Upvotes: 0

user1231231412
user1231231412

Reputation: 1659

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

Upvotes: 3

Related Questions