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

How to add title tag to LinkButton Column?

2 Answers 444 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sebastian
Top achievements
Rank 2
Sebastian asked on 25 May 2010, 08:44 AM
Hi,

I have the following Column:
protected static void CreateAndAddRadGridAuditViewCommandColumn(RadGrid grid)  
{  
    GridButtonColumn auditColumn = new GridButtonColumn()  
    {  
        UniqueName = "AuditView",  
        ButtonType = GridButtonColumnType.LinkButton,  
        Text = "      " // just make background image from css class visible (using CSS sprites)  
    }; 
    column.HeaderStyle.CssClass = "rgHeader " + "cms-column-auditview";  
    column.ItemStyle.CssClass = newCssClass; 
    grid.Columns.Add(auditColumn); 
}  


The corresponding CSS class is:
.cms-column-auditview a { 
    text-decorationnone !important; 
    backgroundurl(/Cms/Resources/Images/iconset.png) 0px -2032px no-repeat
}

Now I want to add a mouseover hint to those images using a "Title" attribute on the link that is rendered.
I need to use CSS sprites for performance reasons. How can I achieve this?

Regards,

   Sebastian


2 Answers, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 26 May 2010, 08:52 AM
Hi Sebastian,

To access the link buttons in the button column programmatically, and set the ToolTip attribute of the LinkButtons inside, you can use RadGrid's ItemCreated event:

protected void RadGrid1_ItemCreated(Object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        (item["AuditView"].Controls[0] as LinkButton).ToolTip = "tooltip text";
    }
}


Regards,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sebastian
Top achievements
Rank 2
answered on 26 May 2010, 10:04 AM
Great, Thanks. That works like charm.
Tags
Grid
Asked by
Sebastian
Top achievements
Rank 2
Answers by
Veli
Telerik team
Sebastian
Top achievements
Rank 2
Share this question
or