We help IT Professionals succeed at work.
Get Started

selecting multiple date in asp.net calendar control

adamtrask
adamtrask asked
on
2,346 Views
Last Modified: 2012-05-11
Hello experts,

I need to be able to select multiple dates on a calendar control and highlight the selected cells' background color.

To be more precise, I need to let the user select a start date and an end date and have all the cells through these two dates highlighted.

I tried the code below which does exactly what I want when the user clicks a date in the calendar, but once he/she click on another date the highlight is moved from the first date to the latter. I need the highlight to stay on all selected dates. Or, better still, the user enters a start date into a text box and and and an end date into a second box and the dates from start to end be highlighted.

Thanks

 Protected Sub Calendar1_DayRender(ByVal sender As Object, _
  ByVal e As DayRenderEventArgs) Handles calendar1.DayRender

        If e.Day.IsSelected = True Then
            e.Cell.BackColor = System.Drawing.Color.Yellow
        End If

    End Sub

thanks
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE