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

Coloring added/modifed rows

2 Answers 79 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric Moreau
Top achievements
Rank 2
Iron
Iron
Veteran
Eric Moreau asked on 20 Oct 2010, 03:01 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 20 Oct 2010, 04:07 PM
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
0
Eric Moreau
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 21 Oct 2010, 01:46 AM
It is working great. Thanks Richard.
Tags
GridView
Asked by
Eric Moreau
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Richard Slade
Top achievements
Rank 2
Eric Moreau
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or