Richard Ev
Richard Ev

Reputation: 54167

asp:Calendar DateClicked event (not just SelectionChanged)

I am using the standard asp:Calendar control. When a user clicks a date, I am showing a modal popup by handling the SelectionChanged event.

However this means that nothing happens if the user clicks a date, then closes the popup, then clicks the same date again.

I'd rather be handling a DateClick event, and do away with the concept of having a selected date altogether.

Can this be achieved using the asp:Calendar?

Upvotes: 2

Views: 6585

Answers (2)

Polecat Harris
Polecat Harris

Reputation: 177

I had a similar problem - I solved it by preventing the user from selecting the currently selected date. I put the following in the DayRender event:

If e.Day.Date = DateValue(calCalendar.SelectedDate) Then
    e.Day.IsSelectable = False
End If

Upvotes: 3

Richard Ev
Richard Ev

Reputation: 54167

Found a workaround:

In the SelectionChanged event handler, just call

calendar.SelectedDates.Clear();

Upvotes: 4

Related Questions