0

我通过代码将工具提示添加到 ASP.NET 日历控件:

string newToolTip = string.Format(@"<div class='tooltip'><div class='toolHead'>{0}</div><div class='toolDate'>{1}-{2}</div></div>",sEvent.Title, sEvent.FromDate, sEvent.ToDate);
e.Cell.ToolTip = newToolTip;
e.Cell.Attributes.Add("OnClick", string.Format("javascript:__doPostBack('Karl Ender','{0}')", sEvent.Title));

其中“e”是 DayRenderEventArgs :

Calendar.DayRender += new DayRenderEventHandler(SpecialDayRender);

在页面的第一次加载时一切正常,产生以下(正确的)html代码:

<td title="" class="calendarcell" align="center" onclick="javascript:__doPostBack('Karl Ender','Hallo Welt')" style="color:White;background-color:Silver;width:14%;">7<div class="tooltip"><div class="toolHead">Hallo Welt</div><div class="toolDate">11/7/2012-5/9/2013</div></div></td>

当我在日历控件中更改月份(或进行另一个部分回发)时,Html 代码突然变得头晕目眩:

<td title="&lt;div class='tooltip'&gt;&lt;div class='toolHead'&gt;Hallo Welt&lt;/div&gt;&lt;div class='toolDate'&gt;11/7/2012-5/9/2013&lt;/div&gt;&lt;/div&gt;" class="calendarcell" align="center" onclick="javascript:__doPostBack('Karl Ender','Hallo Welt')" style="color:White;background-color:Silver;width:14%;">7</td>

因此,工具提示被呈现为该单元格的“标题”属性

有什么线索吗?

(日历在更新面板中)

调试代码时,单元格的 Title-Attribute 永远不会充满奇怪的内容

4

0 回答 0