Content based row formatting in Hierarchical GridView

4 posts, 1 answers
  1. Marco
    Marco avatar
    17 posts
    Member since:
    Jun 2018

    Posted 02 Oct 2018 Link to this post

    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

  2. Marco
    Marco avatar
    17 posts
    Member since:
    Jun 2018

    Posted 05 Oct 2018 in reply to Marco Link to this post

    Any Ideas on this?
  3. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3567 posts

    Posted 05 Oct 2018 Link to this post

    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.
  4. Marco
    Marco avatar
    17 posts
    Member since:
    Jun 2018

    Posted 22 Oct 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi Dess

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

    Kind Regards
    Marco

Back to Top