为devexpress gridview的每个单元设置工具提示

时间:2010-04-30 05:19:15

标签: devexpress

如何在asp.net&amp ;;中为devexpress gridview的每个单元设置工具提示c#.net

2 个答案:

答案 0 :(得分:2)

首先,设置网格的“OnHtmlDataCellPrepared”属性,如下所示:

<dx:ASPxGridView ID="ASPxGridView1" runat="server" 
    OnHtmlDataCellPrepared="ASPxGridView1_HtmlDataCellPrepared">
</dx:ASPxGridView>

然后在代码隐藏中设置单元格的“title”属性:

protected void ASPxGridView1_HtmlDataCellPrepared(object  sender,  DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs  e)  
{
    e.Cell.Attributes.Add("title", "Your Tooltip");
}

答案 1 :(得分:0)

与mhughes相同的概念,但在我的情况下,gridView是动态创建的,所以我不得不在事后添加事件处理程序。

_gridview.HtmlDataCellPrepared + = new ASPxGridViewTableDataCellEventHandler(_gridview_HtmlDataCellPrepared);

void _gridview_HtmlDataCellPrepared(object sender,ASPxGridViewTableDataCellEventArgs e)
{
if(e.CellValue!= null)
e.Cell.Attributes.Add(“title”,e.CellValue.ToString());
}