Gridview工具提示插入索引或检查单元格的值

Gridview工具提示插入索引或检查单元格的值,gridview,header,tooltip,Gridview,Header,Tooltip,尝试使用以下代码在gridview上使用不同的工具剪裁方法: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { { if (e.Row.RowType == DataControlRowType.Header) { fore

尝试使用以下代码在gridview上使用不同的工具剪裁方法:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {

            { 
                if (e.Row.RowType == DataControlRowType.Header) 
                    { 
                        foreach (TableCell cell in e.Row.Cells) 
                            { 
                                foreach (Control ctl in cell.Controls) 
                                    { 
                                        if (ctl.GetType().ToString().Contains("DataControlLinkButton")) 
                                            { 
                                                cell.Attributes.Add("title", "tooltip text for " + ((LinkButton)ctl).Text);

                                            } 

                                    } 
                            } 
                    } 
            }

        }
我将如何处理这段代码,使第一列工具提示显示“呈现类别描述”,第二列显示“表示总百分比”,等等

我不确定如何为每一列实现不同的工具提示文本——我是实现索引还是添加到另一个循环中?我不知道从这里该怎么办……抱歉,我太厚了。

你为什么不使用

ToolTip='<%# Eval("ColumnName")%>'
工具提示=“”
在itemtemplate中,当您绑定Text属性时,也会绑定tooltip属性(在aspx文件中)