How to add title tag to LinkButton Column?

3 posts, 1 answers
  1. Sebastian
    Sebastian avatar
    13 posts
    Member since:
    Feb 2009

    Posted 25 May 2010 Link to this post

    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. Answer
    Veli
    Admin
    Veli avatar
    2002 posts

    Posted 26 May 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sebastian
    Sebastian avatar
    13 posts
    Member since:
    Feb 2009

    Posted 26 May 2010 Link to this post

    Great, Thanks. That works like charm.
Back to Top