itemstyle-cssclass, need to make one link red

4 posts, 0 answers
  1. David Avery
    David Avery avatar
    57 posts
    Member since:
    Apr 2006

    Posted 18 Aug 2010 Link to this post

    Hi, I have a requirement that one column, if a link appears, it be red and bold.  I am using a skin, and it will not allow my class to shine through (color is getting overrriden by the skin)  My CSS file has a "redlink: in it as below, and it is being used as the itemstyle-cssclass, but it is keeping the skin color.  I am aware I could set overall link colors, but the appearance of any values in these columns is a special case, and therefore the customer wants it red.  Can anyone help please?


    from css:

        colorred !important;
        font-weightbold !important;;

    what the column def is:
    <telerik:GridHyperLinkColumn HeaderText="Notes" SortExpression="noteCount" DataTextField="noteCount" ItemStyle-CssClass="redlink" DataTextFormatString="{0:#;;}"
        DataNavigateUrlFields="Claim Number" Target="_blank"
        DataNavigateUrlFormatString="ClaimNoteDisplay.aspx?cid={0}" UniqueName="ClaimNotes">

    how it renders
    <td class="redlink"><a href="ClaimNoteDisplay.aspx?cid=78952" target="_blank"></a> </td>
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Aug 2010 Link to this post

    Hello David,

    Try to set CssClass for links from code behind like below.

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
            if (e.Item is GridDataItem)
                GridDataItem item = (GridDataItem)e.Item;
                HyperLink link = (HyperLink)item["ClaimNotes"].Controls[0];
                link.CssClass = "redlink";

  3. David Avery
    David Avery avatar
    57 posts
    Member since:
    Apr 2006

    Posted 19 Aug 2010 Link to this post

    Thanks Princy

    I thought about doing that, but it's nice to have grids with self contained logic.  I wonder why that property is there if it doesn't work easily?  I don't mind writing code, but I have many pages that use telerik products that are hard to support for junior level people because there is always some sort of "hack" to override functionality that should be working. 

    I wish it would just respect the !important tag and let me color it my way :(
  4. Dimo
    Dimo avatar
    8407 posts

    Posted 19 Aug 2010 Link to this post

    Hi David ,

    <a> elements do not inherit color and text-decoration styles, so you should use

    .redlink  a
        color: red !important;
        font-weight: bold !important;;

    Sincerely yours,
    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
Back to Top