ASP.NET Calendar Control Graphics

How do I insert graphics into Calendar class days?

Page 1 of 1

1 Replies - 3193 Views - Last Post: 14 March 2009 - 07:48 PM Rate Topic: -----

#1 plnelson   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 31
  • Joined: 11-February 09

ASP.NET Calendar Control Graphics

Posted 12 March 2009 - 01:28 PM

I'm writing a web app where several people on a project can see each others' schedules. I want to display them in a Calendar control and have a list of people under the calendar, each with a little colors associated with them. (the number of people will be small - 4 or 5 max) . Their availability will be shown in the calendar by the days that contain little dots or squares of their color.

The idea is that someone seeing the calendar can see everyone's availability and where they overlap so meetings, etc, can be scheduled. So obviously some days will need more than one color in them. I plan to make the colors by having little JPEG squares or rectangles and insert them in the cells.

I assume if I override OnDayRender() I can insert graphics into the cell, but I don't understand how to do this. Also, if I want to avoid making LOTS of little JPEGs with every possible combination of colors, it would be good to be able to insert more than one JPEG into the same cell.

Thanks in advance for advice about this!

Is This A Good Question/Topic? 0
  • +

Replies To: ASP.NET Calendar Control Graphics

#2 plnelson   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 31
  • Joined: 11-February 09

Re: ASP.NET Calendar Control Graphics

Posted 14 March 2009 - 07:48 PM

View Postplnelson, on 12 Mar, 2009 - 12:28 PM, said:

I'm writing a web app where several people on a project can see each others' schedules. I want to display them in a Calendar control and have a list of people under the calendar, each with a little colors associated with them. (the number of people will be small - 4 or 5 max) . Their availability will be shown in the calendar by the days that contain little dots or squares of their color.

The idea is that someone seeing the calendar can see everyone's availability and where they overlap so meetings, etc, can be scheduled. So obviously some days will need more than one color in them. I plan to make the colors by having little JPEG squares or rectangles and insert them in the cells.

I assume if I override OnDayRender() I can insert graphics into the cell, but I don't understand how to do this. Also, if I want to avoid making LOTS of little JPEGs with every possible combination of colors, it would be good to be able to insert more than one JPEG into the same cell.

Thanks in advance for advice about this!


I never got even one answer to this! But luckily several people on another developers' forum knew how to do it so I thought I'd share it here . . .

   protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
	{
		Image img1 = new Image();
		img1.ID = "MyImage1";
		img1.ImageUrl = "vred12x24.jpg";
		img1.Width = Unit.Pixel(12);
		img1.Height = Unit.Pixel(24);

		e.Cell.Controls.Add(img1);
	}



Here's a little demo page where I add little colored JPEGs representing hypothetical people's schedules. Ultimately I'll use something like this in a web-app I'm writing . . .

Little Demo Page
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1