简体   繁体   English

如何将CssClass添加到ASP.Net Calendar WebControl中的当前显示月份

[英]How to add a CssClass to the current displayed month in ASP.Net Calendar webcontrol

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. 我目前正在将ASP.Net日历( system.web.ui.webcontrols.calendar )实现到设计中,这需要我在标题中向显示的月份添加一个类。 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. 我没有找到任何可以解决我的问题的属性,也没有在获取实际的HTML服务器控件方面取得任何成功。

Thanks in advance, David. 预先感谢大卫。

Assuming that you are talking about the ASPNet AjaxToolKit Calendar Control: 假设您正在谈论ASPNet AjaxToolKit日历控件:

The relevant class for the header is " ajax__calendar_header ". 标头的相关类是“ ajax__calendar_header ”。 You override this class in your css. 您可以在CSS中覆盖此类。

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

Edit : after op comments: 编辑 :在op注释后:

Using the server control, there is a property called TitleStyle . 使用服务器控件,有一个名为TitleStyle的属性。 You can specify your formatting here. 您可以在此处指定格式。 Alternatively, you can use the property TitleStyle-CssClass to apply a css class to the header. 另外,可以使用属性TitleStyle-CssClass将CSS类应用于标题。

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

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM