Question

I am currently working on implementing an ASP.Net calendar (system.web.ui.webcontrols.calendar) into a design which requires me to add a class to the displayed month in the title. To be specific, the rendered code today is:

<tr>
    <td>[Previous navigation link goes here]</td>
    <td>August</td>
    <td>[Next navigation link goes here]</td>
</tr>

What I would like to have is:

<tr>
    <td>[Previous navigation link goes here]</td>
    <td class="CustomCssClass">August</td>
    <td>[Next navigation link goes here]</td>
</tr>

Is this possible? I have not found any property which solves my problem nor have I had any success in fetching the actual HTML server control.

Thanks in advance, David.

Was it helpful?

Solution

Assuming that you are talking about the ASPNet AjaxToolKit Calendar Control:

The relevant class for the header is "ajax__calendar_header". You override this class in your css.

.ajax__calendar_header { background-color: yellow !important; }

Edit: after op comments:

Using the server control, there is a property called TitleStyle. You can specify your formatting here. Alternatively, you can use the property TitleStyle-CssClass to apply a css class to the header.

<asp:Calendar ID="cal" runat="server" TitleStyle-CssClass="cssclass"></asp:Calendar>

Hope that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top