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

itemstyle-cssclass, need to make one link red

3 Answers 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Avery
Top achievements
Rank 1
David Avery asked on 18 Aug 2010, 10:09 PM
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?

Thanks

from css:
.redlink

{
    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">
</telerik:GridHyperLinkColumn>

how it renders
<td class="redlink"><a href="ClaimNoteDisplay.aspx?cid=78952" target="_blank"></a> </td>

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Aug 2010, 07:41 AM
Hello David,

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

C#:
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";
        }
    }

Thanks,
Princy.
0
David Avery
Top achievements
Rank 1
answered on 19 Aug 2010, 02:39 PM
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 :(
0
Dimo
Telerik team
answered on 19 Aug 2010, 02:47 PM
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,
Dimo
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
Tags
Grid
Asked by
David Avery
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
David Avery
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or