Coloring added/modifed rows

3 posts, 1 answers
  1. Eric Moreau
    Eric Moreau avatar
    22 posts
    Member since:
    Sep 2007

    Posted 20 Oct 2010 Link to this post

    What is the best way to colorize newly added rows or rows that have been modified in a radgrid?

    I want a visual cue for my users of needs to be saved.
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 20 Oct 2010 Link to this post

    Hi Eric,

    Can you try this. It seems to work for me when adding a new row or modifying an existing one.

    Private Sub RadGridView_RowFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.RowFormattingEventArgs) Handles RadGridView.RowFormatting
        If e.RowElement.RowInfo.IsModified Then
            e.RowElement.ForeColor = Color.Red
        End If
        If e.RowElement.RowInfo.Tag IsNot Nothing Then
            If e.RowElement.RowInfo.Tag.ToString() = "NEW" Then
                e.RowElement.ForeColor = Color.Red
            End If
        End If
    End Sub
    Private Sub RadGridView_RowsChanged(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.GridViewCollectionChangedEventArgs) Handles RadGridView.RowsChanged
        If e.Action = Telerik.WinControls.Data.NotifyCollectionChangedAction.Add Then
            e.GridViewTemplate.Rows(e.NewStartingIndex).Tag = "NEW"
        End If
    End Sub

    hope that helps
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Eric Moreau
    Eric Moreau avatar
    22 posts
    Member since:
    Sep 2007

    Posted 20 Oct 2010 Link to this post

    It is working great. Thanks Richard.
Back to Top