Problem with calendar control

R

Ron Harter

I am unable to set the width for the day cells in the calendar control. I am
controls to various days for events and have set wrap to false. The problem
I am having is I am getting some really skinny days because they are getting
squeezed. I have tried to set the width in the DayRender handler but an hot
having any luck. Anyone got any suggestions?
 
S

Stan

I am unable to set the width for the day cells in the calendar control. Iam
controls to various days for events and have set wrap to false. The problem
I am having is I am getting some really skinny days because they are getting
squeezed. I have tried to set the width in the DayRender handler but an hot
having any luck. Anyone got any suggestions?

Hi Ron

I think the problem lay in the fact that day column widths are
normally set using percentages. So, for example, if you set the column
of one of them to a pixel value the browser readjusts the table width
to preserve the ratios of the other columns which results in all
columns still being the same width.

To exercise proper control it is necessary to set the width of each
column explicitly. For example to make Monday twice as wide as the
other days the DayRender event code could be:

if(e.day.DayOfWeek == DayOfWeek.Monday) e.day.cell.width =
Unit.Percentage(25.0);
else e.Cell.DayOfWeek.Width = Unit.Percentage(12.5);

HTH
 
S

Stan

if(e.day.DayOfWeek == DayOfWeek.Monday) e.day.cell.width =
Unit.Percentage(25.0);
else e.Cell.DayOfWeek.Width = Unit.Percentage(12.5);

Oops that should have been:

if(e.day.DayOfWeek == DayOfWeek.Monday)
e.cell.width = Unit.Percentage(25.0);
else e.cell.Width = Unit.Percentage(12.5);

sorry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top