开发者

Gridview tooltip inserting index or check cell for value

开发者 https://www.devze.com 2022-12-17 19:07 出处:网络
Trying a different approach for tooltipping on a gridview using the following code: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

Trying a different approach for tooltipping on a gridview using the following code:

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);

                                            } 

                                    } 
                            } 
                    } 
            }

        }

How would I go about manipulating this code so that the first column tooltip says " presents the category description", the second column says "represents the total percentage", etc, etc.

I'm not su开发者_运维技巧re how would go about achieving different tooltip text for each column - would I implement an index or add in another loop? I'm not sure where to go from here...apologies for being thick.


Why don't you use the

ToolTip='<%# Eval("ColumnName")%>'

in the itemtemplate when you bind the Text property also bind the tooltip property as well(in aspx file).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号