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

ConditionalFormatting on Not visible column

1 Answer 128 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Simone Belia
Top achievements
Rank 1
Simone Belia asked on 23 Apr 2008, 09:53 AM
Hi I am trying to apply a conditional formatting to a column (Status) set as not visible in the gridview properties.

If the columns is visible everthing works fine, but if it is not visible the conditional formatting doesn't work.

there is a way to let it work?

Thank you in advance

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 23 Apr 2008, 01:41 PM
Hi Simone Belia,

Thank you for this question.

Conditional formatting in RadGridView works only for columns which are visible. You should use the CellFormatting event for more complex conditions. Refer to the following code snippet:

void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) 
    if (e.CellElement.ColumnInfo is GridViewDataColumn) 
    { 
        GridDataCellElement dataCell = (GridDataCellElement)e.CellElement; 
        GridViewDataColumn dataColumn = (GridViewDataColumn)e.CellElement.ColumnInfo; 
        if (dataColumn.FieldName == "Value"
        { 
            if ((int)dataCell.Value > 10 && !dataCell.RowElement.IsCurrent) 
            { 
                dataCell.BackColor = Color.Red; 
                dataCell.DrawFill = true
            } 
            else 
            { 
                dataCell.DrawFill = false
            } 
        } 
    } 

I hope this helps. Do not hesitate to write, if you have other questions.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Simone Belia
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or