Search results

Apply conditional formatting for specific row or column in ASP.NET Core Pivot Grid control

21 Oct 2021 / 1 minute to read

You can apply conditional formatting for specific row or column using label option in the pivot grid. It can be configured using the conditionalFormatSettings option through code behind, during initial rendering. The required settings are:

  • label: Specifies the header name to apply conditions for row or column.
  • condition: Specifies the operator type such as equals, greater than, less than, etc.
  • value1: Specifies the start value.
  • value2: Specifies the end value.
  • style: Specifies the style for the cell.

To use the conditional formatting feature, You need to inject the ConditionalFormatting module in Pivot Grid.

Copied to clipboard
<ejs-pivotview id="PivotGrid"  width="100%" height="300" allowConditionalFormatting="true" showFieldList="true">
                <e-datasource data="" expandAll="false" enableSorting="true">
                        <e-field name="Amount" format="C0" maximumSignificantDigits="10" minimumSignificantDigits="1" useGrouping="true"></e-field>
                        <e-field name="Country"></e-field>
                        <e-field name="Products"></e-field>
                        <e-field name="Year"></e-field>
                        <e-field name="Order_Source" caption="Order Source"></e-field>
                        <e-field name="In_Stock" caption="In Stock"></e-field>
                        <e-field name="Sold" caption="Units Sold"></e-field>
                        <e-field name="Product_Categories" caption="Product Categories"></e-field>
                        <e-format label="Germany" conditions="Between" value1="500" value2="50000">
                            <e-fieldlist-style backgroundColor="#f48fb1" color="black" fontFamily="Tahoma" fontSize="12px" />
                <e-gridSettings columnWidth="100"></e-gridSettings>
Copied to clipboard
public ActionResult Index()
    var data = GetPivotData(); = data;
    return View();