Winforms - Radgrid RowFormatting Example

This short example shows how to change the background color of a row conditionally                       

 

Private Sub RadGridView2_RowFormatting(sender As Object, e As RowFormattingEventArgs) Handles RadGridView2.RowFormatting
    Dim oRow As GridViewRowInfo = RadGridView2.CurrentRow
 
    Dim intDecimalPlaceQuantity As Double = oRow.Cells("decplqty").Value
    Dim decOriginalQty As Double = oRow.Cells("Quantity").Value
 
    oRow.Cells("Quantity").Value = Common.GetFormattedAmount(intDecimalPlaceQuantity, decOriginalQty)
    oRow.Cells("Quantity").ReadOnly = True
 
End Sub

 

Private Sub RadGridDragAndDrop1_RowFormatting(sender As Object, e As RowFormattingEventArgs) Handles RadGridDragAndDrop1.RowFormatting
    Try
        If e.RowElement.RowInfo.Cells("naflag").Value = 1 Then
            e.RowElement.DrawFill = True
            e.RowElement.ForeColor = Color.Red
            e.RowElement.BackColor = Color.White
            e.RowElement.BackColor2 = Color.White
            e.RowElement.BackColor3 = Color.White
            e.RowElement.BackColor4 = Color.White
        Else
            e.RowElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local)
        End If
    Catch ex As Exception
 
    End Try
End Sub

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences