gpt4 book ai didi

telerik - 有一个 RadGrid 需要向列行添加工具提示

转载 作者:行者123 更新时间:2023-12-04 05:26:47 25 4
gpt4 key购买 nike

我正在使用 RadGrid。有一个名为 Comments 的列,我目前将其作为 Y/N
如果他们将鼠标悬停在评论标题行上,我喜欢添加一个工具提示。有没有一种简单的方法可以做到这一点?对于名为 CommentsY/N 的列,我的值为 Y/N。我还有一个名为“评论”的专栏,我正在隐藏它。当用户将鼠标悬停在 CommentsY/N 上时,我喜欢显示 Comments 字段值。

到目前为止,我有以下内容:

我想要做的是将鼠标悬停在 Notes 列行上,然后显示 Comments,这也是网格上的绑定(bind)列。由于注释可能很长,我想在用户将鼠标悬停在注释上时显示它。一旦悬停工作,我将使评论字段不可见。
这就是我所拥有的,但问题是当我将鼠标悬停在注释上时,我只看到它说 Cmmts 并且它不显示给定行的注释内容。

    if (e.Item is GridDataItem)
{
GridDataItem gridItem = e.Item as GridDataItem;
foreach (Telerik.Web.UI.GridColumn column in WtrClients.MasterTableView.RenderColumns)
{
if (column is GridBoundColumn)
{
//this line will show a tooltip based on the CustomerID data field
if (column.UniqueName == "Notes")
{
gridItem[column.UniqueName].ToolTip = "Cmmts:" +
Convert.ToString(gridItem.OwnerTableView.DataKeyValues[gridItem.ItemIndex]["Comments"]);
}

}
}
}

最佳答案

你可以做一个Label ItemTemplate在网格中,评估您的评论中是否有任何内容以显示 YN然后设置工具提示。 :

<ItemTemplate>
<asp:Label ID="lblOnGrid" runat="server" Text='<%#Convert.ToString(Eval("comments_column")).Equals("") ? "N" : "Y" %>'
ToolTip='<%#Eval("comments_column")%>'>
</asp:Label>
</ItemTemplate>

关于telerik - 有一个 RadGrid 需要向列行添加工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13123095/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com