Problem with calendar control

Discussion in 'ASP .Net Web Controls' started by Ron Harter, Jul 3, 2009.

  1. Ron Harter

    Ron Harter Guest

    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?
     
    Ron Harter, Jul 3, 2009
    #1
    1. Advertisements

  2. Ron Harter

    Stan Guest

    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
     
    Stan, Jul 5, 2009
    #2
    1. Advertisements

  3. Ron Harter

    Stan Guest

    if(e.day.DayOfWeek == DayOfWeek.Monday) e.day.cell.width =
    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
     
    Stan, Jul 5, 2009
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.