Alternating Row Style

 
Company Name City Region Country Unit Price Quantity Total
Vins et alcools ChevalierReims France$14.0012$168.00
Vins et alcools ChevalierReims France$10.0010$100.00
Vins et alcools ChevalierReims France$35.005$175.00
Toms SpezialitätenMünster Germany$19.009$171.00
Toms SpezialitätenMünster Germany$42.0040$1,680.00
Hanari CarnesRio de JaneiroRJBrazil$8.0010$80.00
Hanari CarnesRio de JaneiroRJBrazil$42.0035$1,470.00
Hanari CarnesRio de JaneiroRJBrazil$17.0015$255.00
Victuailles en stockLyon France$17.006$102.00
Victuailles en stockLyon France$16.0015$240.00
Victuailles en stockLyon France$17.0020$340.00
Suprêmes délicesCharleroi Belgium$65.0040$2,600.00
Suprêmes délicesCharleroi Belgium$2.0025$50.00
Suprêmes délicesCharleroi Belgium$27.0040$1,080.00
Hanari CarnesRio de JaneiroRJBrazil$10.0020$200.00
Hanari CarnesRio de JaneiroRJBrazil$14.0042$588.00
Hanari CarnesRio de JaneiroRJBrazil$16.0040$640.00
Chop-suey ChineseBern Switzerland$4.0015$60.00
Chop-suey ChineseBern Switzerland$19.0021$399.00
Chop-suey ChineseBern Switzerland$8.0021$168.00
Data grid with 2155 rows and 7 columns
0 rows are selected

Our DevExpress Grid for Blazor allows you to customize the appearance of UI elements based on custom conditions. This module demonstrates how to highlight alternating (odd) rows with a different style to enhance readability.

To do this, handle the Grid's CustomizeElement event and use the following event arguments to modify row and cell styles:

  • ElementType — An element type.
  • CssClass — The name of a CSS class applied to a grid element.
  • Attributes — Standard HTML attributes applied to a grid element.
  • Style — A standard HTML style attribute applied to a grid element.
  • VisibleIndex — The visible index of the processed row or row that contains the processed cell.
  • Column- The column that corresponds to the processed cell or group row.
  • Grid — Provides access to grid properties.

This demo customizes the appearance of grid elements in the following way:

  • All odd rows are highlighted.
  • Column headers are bold.
  • The custom background color is applied to the column header row.