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

[Solved] Alternate font color in the columns of RadGrid

3 Answers 127 Views
RadControls
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jana
Top achievements
Rank 1
jana asked on 18 Apr 2008, 10:07 AM
Is it possible to give alternate color for columns in the RadGrid.

For eg:

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 18 Apr 2008, 11:24 AM
Hello jana,

Please review the following help article elaborating on the matter.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
jana
Top achievements
Rank 1
answered on 21 Apr 2008, 11:06 AM
The artical which you have refered explains about the color change in the Rows, but what i need is Change of Font colors in Columns.Can you please help me regarding this.

Thanks,
Jana
0
Accepted
Vlad
Telerik team
answered on 21 Apr 2008, 03:34 PM
Hi jana,

Here is an example how to accomplish this using ItemStyle.CssClass (in this case of auto-generated columns using ColumnCreated):

    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        if (e.Column.IsBoundToFieldName("ProductID"))
        {
            e.Column.ItemStyle.CssClass = "MyClass1";
        }
        else if (e.Column.IsBoundToFieldName("ProductName"))
        {
            e.Column.ItemStyle.CssClass = "MyClass2";
        }
        else if (e.Column.IsBoundToFieldName("SupplierID"))
        {
            e.Column.ItemStyle.CssClass = "MyClass1";
        }
    }

...
    <style type="text/css">
        .MyClass1
        {
            color: Red;
        }
       
         .MyClass2
        {
            color: Blue;
        }
    </style>

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
RadControls
Asked by
jana
Top achievements
Rank 1
Answers by
Steve
Telerik team
jana
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or