如何在 ASP.Net 工具提示中显示富文本?
我使用以下代码显示工具提示
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="AccessDataSource1">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="datefu" HeaderText="date"
SortExpression="datefu" />
<asp:TemplateField HeaderText="title" SortExpression="titlefu">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("titlefu") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<a href="#" title="<asp:Literal ID="Label1" runat="server" Text='<%# Eval("fu") %>'/>"/>
<asp:Label ID="NamePatientLabel" runat="server" Text='<%# Eval("titlefu") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
,显示以下结果
但是,当我按如下方式编辑文本时(使其在另一个包含富文本编辑器的网格视图中粗体和红色)
我得到以下内容(作为第二个网格视图中的格式化结果)
但是,当我在第一个 gridview 中查看以显示工具提示时,我得到以下结果
我真的需要你的帮助将工具提示显示为富文本
虽然很多人说jquery“非常简单”,但如果您有jquery以外的解决方案,请告诉我。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要使用浏览器的本机工具提示,而是实现某种气球提示。有很多方法可以做到这一点,本页显示了 jquery 中的 12 种方法 http://www.dreamcss.com/2009/05/12-jquery-tooltip-for-web-developer.html
一个使用 qTip 是向所有包含文本的 a-href 添加一个名为 tooltip 的属性并执行此 jquery 启动脚本
Don't use the browser's native tooltip but implement some kind of balloon tip. There are many ways to do this, this page shows 12 ways in jquery http://www.dreamcss.com/2009/05/12-jquery-tooltip-for-web-developer.html
A simple example with qTip is to add an attribute named tooltip to all your a-hrefs containing your text and executing this jquery startup script
您可能需要查看 HoverMenuExtender 中的 < a href="http://www.asp.net/ajax/AjaxControlToolkit/Samples/" rel="nofollow">AjaxControlToolkit。尽管有这个名字,它不仅仅显示菜单 - 您可以使用它来弹出窗口。我只是用它来做一些类似于你想做的事情。
例如
You might want to take a look at the HoverMenuExtender in the AjaxControlToolkit. Despite the name it doesn't just display menus - you can use it to do popups. I just used it to do something similar to what you want to do.
e.g.
试试这个
如何使用AJAX工具提示控件?
try this
How to use AJAX tooltip control?