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

Content based row formatting in Hierarchical GridView

3 Answers 17 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 02 Oct 2018, 08:36 AM

Hello Guys

I'm trying to change the font color of the complete row based on a value of a column. Currently I do this:

private void LicensesList_RowFormatting(object sender, RowFormattingEventArgs e)
{
    if (e.RowElement.VisualCells.Count == 0) return;
    e.RowElement.ForeColor = (bool) e.RowElement.VisualCells[7].Value ? Color.Red : Color.Green;
}

which is basically working but not for the Child rows. They appear black at first and change color when I select them. Also, if I do a .MasterTemplate.Refresh() all the columns turn black again until they are selected. Is there something I've missed or is my approach bad?

Thank You

3 Answers, 1 is accepted

Sort by
0
Marco
Top achievements
Rank 1
answered on 05 Oct 2018, 11:41 AM
Any Ideas on this?
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Oct 2018, 02:00 PM
Hello, Marco, 

I would recommend you to use the CellFormatting event and customize the desired cells considering the a value from the data row. Please refer to the following help article demonstrating how to apply different style: https://docs.telerik.com/devtools/winforms/gridview/cells/formatting-cells 

If you are still experiencing any further difficulties, feel free to submit a support ticket where you can provide a sample project demonstrating the undesired look you are facing. Thus, we would be able to think about a suitable solution and assist you further. Thank you in advance.

I hope this information helps.

Regards,
Dess
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Marco
Top achievements
Rank 1
answered on 22 Oct 2018, 09:33 AM

Hi Dess

With the CellFormatting Event it works better, thank you. The RowFormatting event looked so tempting...

Kind Regards
Marco

Tags
GridView
Asked by
Marco
Top achievements
Rank 1
Answers by
Marco
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or