Budzu
Budzu

Reputation: 183

Highlight different events with different colors in a day (cell) ASP.NET calendar

I am working on a page where I need to highlight different events in a day with different colors in a ASP.NET Calendar Cell. The events are store in a database with a start date column.

For example, if we have two different events for today, the cell should display half green and half red color. If there are three events for today, it would 1/3 green, 1/3 red, 1/3 blue in the cell for today.

In addition, currently I use tooltip in jquery to hover a cell, it would display a tooltip above the cell. How to handle this when we have different events in one cell?

All the answers are very much appreciated.

Thank you very much.

Upvotes: 0

Views: 1730

Answers (2)

Budzu
Budzu

Reputation: 183

I think I could answer my own question. I used the DayRender event, and in that event, I did a select statement to get all the events information for each day of the calendars. I could get the number of events in one day from the select statement. Based on how many events on a day, I will add how many divs into the day cell; and based on number of events in one day, I can set the width of the div. In addition, when I added the divs, I added the class for the each div so that I can change the colors of each div.

Upvotes: 2

Brian Mains
Brian Mains

Reputation: 50728

The DayRender event on the calendar gives you full control of the cell. The calendar essentially amounts to a table structure; you will have to use DIV's within the container with a given fixed height and manually apply this logic. It may also be possible on the client, but I think the easiest is the server. It won't be easy, but should be possible.

Upvotes: 1

Related Questions