471,317 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

ASP.Net Calendar - Default height/width?

Hi All,

I am using the <asp: Calendar> object. In the OnDayRender event handler
I am putting text into certain day boxes, and leaving others blank. The
effect is that some months have no additonal text rendered, some months
will have 2 weeks(rows) with no additional content and 1 week with 2 or
3 rows of rendered text. Essentially, the size of the Calendar
fluctuates depending on the data im rendering.

Setting the width property is not a problem and solves the fluctuation
on that axis; however, if I set the height property to, say, 500, then
on a month with 3 blank rows and 1 row with 5 lines of text, the other
rows get squished down .... If I dont specify the height, then the
whole calendar goes tiny on months with no data.

At no point will any row have to hold more than 5 lines of 8pt text.

What I am thinking would be the perfect fix is if I could specify that
every row of the calendar table default to 5 lines of height no matter
what ... then the calendar would always keep a uniform size.

Problem is, not sure how to do that.

Appreciate any input, thanks

Dec 20 '05 #1
2 4499
This probably depends on the way you're adding your rows to each day cell.
My two suggestions would be:

1) Create a panel object that you will add to each day cell. For the days
without anything, you would simply add the following to your panel control:

CalPanel.Controls.Add("&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br
/>&nbsp;");

2) Create a table control that will have 5 rows with each of your blank rows
set as follows:

trCalendar = new TableRow();
tcCalendar = new TableCell();
tcCalendar.Text = "&nbsp;";
trCalendar.Cells.Add(tcCalendar);
tblCalendar.Rows.Add(trCalendar);

This assumes that you will only be using one column within the table.

With either one of these, you can create a user control to handle the
details so that your main application will only be concerned with adding
content to the non-blank rows.

Hope this helps!
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

<to********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi All,

I am using the <asp: Calendar> object. In the OnDayRender event handler
I am putting text into certain day boxes, and leaving others blank. The
effect is that some months have no additonal text rendered, some months
will have 2 weeks(rows) with no additional content and 1 week with 2 or
3 rows of rendered text. Essentially, the size of the Calendar
fluctuates depending on the data im rendering.

Setting the width property is not a problem and solves the fluctuation
on that axis; however, if I set the height property to, say, 500, then
on a month with 3 blank rows and 1 row with 5 lines of text, the other
rows get squished down .... If I dont specify the height, then the
whole calendar goes tiny on months with no data.

At no point will any row have to hold more than 5 lines of 8pt text.

What I am thinking would be the perfect fix is if I could specify that
every row of the calendar table default to 5 lines of height no matter
what ... then the calendar would always keep a uniform size.

Problem is, not sure how to do that.

Appreciate any input, thanks

Dec 21 '05 #2
Thanks Chris, I think #1 is the perfect solution.

Funny thing is I mentioned this problem to my wife. She was like, "just
click on the small boxes and push enter 5 times." Its always the
simplest solution that eludes us the most!!

Dec 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by vinu | last post: by
19 posts views Thread by Stimp | last post: by
reply views Thread by maxrawson | last post: by
2 posts views Thread by Caesar Augustus | last post: by
reply views Thread by GV | last post: by
1 post views Thread by swethak | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.