H
Homer J. Simpson
I'm porting a classic ASP page with a calendar to ASP.NET. I appreciate the
fact that ASP.NET has such a control built-in, but I'm finding it's far less
flexible than I thought it would have. I'm sure I must simply have missed a
few things, so here's a couple of questions:
a) How can I customize the month name? There's a couple of options, eg,
month vs month + year, but I'd prefer to have something like "Aug" instead
of "August"--the amount of space I have horizontally is very limited, and
"s-e-p-t-e-m-b-e-r" is causing my whole calendar to expand wider than I'd
like.
b) Similarly, I want to capitalize the month name (eg, "AUG"). I set
TitleStyle-CssClass to one of my classes, which includes "text-transform:
capitalize", but it doesn't seem to have any effect on IE6. Or is that
supposed to only capitalize the first character? I could've sworn I've used
this in the past to capitalize whole strings...
c) Is the VisibleDate property actually ever useful to *retrieve* the
currently shown month? The docs claim it can be used both to set and get
the current month, but so far, everywhere I've tried to use it, it's still
uninitialized (1/1/0001).
d) I'm trying to replace the Prev/Next month navigation controls with
images. Is this not supported? I've had to revert to setting the
ShowNextPrevMonth attribute to false and putting my own image buttons on top
with absolute positioning--yuck.
e) If you're gonna implement your own month navigation buttons and the
VisibleDate property is always 1/1/0001, how do you intelligently keep track
of where you are (since apparently the control can't tell you)? I'm
currently relying on a session variable in which I store a DateTime. If the
variable doesn't yet exist, I set it to DateTime.Now. Otherwise I adjust
the month in my button callback (....AddMonths(1) / ...AddMonths(-1)) and
save the updated value back in the session variable. Interesting
side-effect to this approach--if I click the refresh button, the last action
is repeated, so if I press Next and then hit refresh repeatedly, the month
moves forward every time.
f) How can I hook up a mouse click event on the title itself (the month)?
I'd like to use that to return to "today's month" without using additional
screen real-estate for another button.
g) I don't want the "other month"'s days to show (eg, the first week of
August shows 29/30/31/1/2/3/4; I'd rather have
[blank]/[blank]/[blank]1/2/3/4. Similarly, 6 weeks are always shown--and in
this particular case, the entire last week is for next month (Sep 2-8). I
can understand that having a fixed number of weeks ensures the amount of
vertical space doesn't change when navigating from month to month, but
ultimately the developer should be able to decide the sort of behavior he
wants. Is this another attribute I've missed?
I could work around a couple of these items by looking at the HTML generated
and hunting for the tags rendered, but I'd *really* not have to revert to
these sort of hacks.
fact that ASP.NET has such a control built-in, but I'm finding it's far less
flexible than I thought it would have. I'm sure I must simply have missed a
few things, so here's a couple of questions:
a) How can I customize the month name? There's a couple of options, eg,
month vs month + year, but I'd prefer to have something like "Aug" instead
of "August"--the amount of space I have horizontally is very limited, and
"s-e-p-t-e-m-b-e-r" is causing my whole calendar to expand wider than I'd
like.
b) Similarly, I want to capitalize the month name (eg, "AUG"). I set
TitleStyle-CssClass to one of my classes, which includes "text-transform:
capitalize", but it doesn't seem to have any effect on IE6. Or is that
supposed to only capitalize the first character? I could've sworn I've used
this in the past to capitalize whole strings...
c) Is the VisibleDate property actually ever useful to *retrieve* the
currently shown month? The docs claim it can be used both to set and get
the current month, but so far, everywhere I've tried to use it, it's still
uninitialized (1/1/0001).
d) I'm trying to replace the Prev/Next month navigation controls with
images. Is this not supported? I've had to revert to setting the
ShowNextPrevMonth attribute to false and putting my own image buttons on top
with absolute positioning--yuck.
e) If you're gonna implement your own month navigation buttons and the
VisibleDate property is always 1/1/0001, how do you intelligently keep track
of where you are (since apparently the control can't tell you)? I'm
currently relying on a session variable in which I store a DateTime. If the
variable doesn't yet exist, I set it to DateTime.Now. Otherwise I adjust
the month in my button callback (....AddMonths(1) / ...AddMonths(-1)) and
save the updated value back in the session variable. Interesting
side-effect to this approach--if I click the refresh button, the last action
is repeated, so if I press Next and then hit refresh repeatedly, the month
moves forward every time.
f) How can I hook up a mouse click event on the title itself (the month)?
I'd like to use that to return to "today's month" without using additional
screen real-estate for another button.
g) I don't want the "other month"'s days to show (eg, the first week of
August shows 29/30/31/1/2/3/4; I'd rather have
[blank]/[blank]/[blank]1/2/3/4. Similarly, 6 weeks are always shown--and in
this particular case, the entire last week is for next month (Sep 2-8). I
can understand that having a fixed number of weeks ensures the amount of
vertical space doesn't change when navigating from month to month, but
ultimately the developer should be able to decide the sort of behavior he
wants. Is this another attribute I've missed?
I could work around a couple of these items by looking at the HTML generated
and hunting for the tags rendered, but I'd *really* not have to revert to
these sort of hacks.