将自定义样式应用于 ASP.Net 日历控件
我想将自定义 CSS 应用到我的日历控件。我已在相应位置应用了相同的内容,例如
e.Cell.CssClass = "highlight";
clndrEvt.TodayDayStyle.CssClass = "currentDay";
clndrEvt.OtherMonthDayStyle.CssClass = "OOB";
clndrEvt.NextPrevStyle.CssClass = "dayTitle";
但是当我渲染控件时,我的样式没有反映出来。
当我检查“查看源代码”时,它会应用我的类(斜体),并且还应用内联样式(下划线),这会覆盖我的样式。例如,
class="highlight" align="center" style="color:White;background-color:Silver;width:14%"
有人可以帮我解决这个问题吗?具体来说,如何通过日历控件的设置属性从 HTML 中删除这些内联样式(通过使用哪些属性)。
我尝试了一些,但没有成功。
e.Cell.Attributes.CssStyle.Clear();
e.Cell.Attributes.Add("Style", string.Empty);
clndrEvt.Style.Clear(); // clndrEvt is my calendar control
I want to apply custom css to my calendar control. I have applied the same at corresponding locations for e.g.
e.Cell.CssClass = "highlight";
clndrEvt.TodayDayStyle.CssClass = "currentDay";
clndrEvt.OtherMonthDayStyle.CssClass = "OOB";
clndrEvt.NextPrevStyle.CssClass = "dayTitle";
However when i render the control, my styles are not reflected.
When i check 'View Source' it applies my classes (italic) and ALSO applies in-line styles (underlined) along with it, which overwrites my styles. For example,
class="highlight" align="center" style="color:White;background-color:Silver;width:14%"
Can anyone help me out with this? To be very specific how to remove those in-line styles (by using which properties) from the HTML by settings properties of calendar control.
I have tried few, but that did not work.
e.Cell.Attributes.CssStyle.Clear();
e.Cell.Attributes.Add("Style", string.Empty);
clndrEvt.Style.Clear(); // clndrEvt is my calendar control
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最近继承的一个项目也遇到了类似的问题。我发现样式是通过
app_themes
中的Master.skin
添加的。那里可能值得检查一下。I had a similar issue recently with a project I had inherited. I worked out that the styling was being added via the
Master.skin
inapp_themes
. Might be worth a check there.