This is a migrated thread and some comments may be shown as answers.

[Solved] Custom expand/collapse tooltips for every row

1 Answer 314 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeffrey Sylvan
Top achievements
Rank 1
Jeffrey Sylvan asked on 14 Apr 2009, 08:22 PM
One of my users wants custom tooltips for every expandable item in the grid. Instead of "Expand" or "Collapse" the user wants "expand a" or "collapse b."

While I'm aware that that there is a way to change this globally for a grid by setting collapsetooltip and expandtooltip in the hiarchysettings, I don't know how to do it for individual items. Is this possible? How would one go about doing this if so?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Apr 2009, 06:55 AM
Hello Jeffrey,

A possible solution is to access the ExpandColumn button and set its ToolTip according to your requirement. Refer to the code below to  understand better:
c#:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach(GridDataItem dataItem in RadGrid1.Items) 
        { 
            Button btn = (Button)dataItem["ExpandColumn"].Controls[0]; 
            if (!dataItem.Expanded) 
            { 
                btn.ToolTip = "Expand " + dataItem["Name"].Text + ""
            } 
            else if (dataItem.Expanded) 
            { 
                btn.ToolTip = "Collapse " + dataItem["Name"].Text + ""
            } 
        }               
    } 

Thanks
Princy.
Tags
Grid
Asked by
Jeffrey Sylvan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or