We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Conditional cell formating with date


i am using your sample http://asp.syncfusion.com/demos/web/grid/conditionalformatting.aspx

How can i do to have celle with a date < now in formated with red text ?

Thank you !

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team April 5, 2017 06:20 AM UTC

Hi Guyot, 

Thanks for contacting Syncfusion support. 

To achieve your requirement, use queryCellInfo event of ejGrid. In this event we check the condition with the column and apply the css based on the mentioned condition.  

Find code example, screenshot and sample:  

         <ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowPaging="True"> 
            <ClientSideEvents QueryCellInfo="formatingCell" /> 
                <ej:Column Field="OrderDate" HeaderText="Order Date" TextAlign="Right" Width="80" Format="{0:MM/dd/yyyy}" Priority="2" /> 

    function formatingCell(args) { 
        if (args.column.field == "OrderDate") { 
            var date = args.data.OrderDate; 
            var currentDate = new Date(); 
            if (date < currentDate) { 
                $(args.cell).css("color", "red"); 



Refer to the Help document for the queryCellInfo event.  

Prasanna Kumar N.S.V 

Live Chat Icon For mobile
Up arrow icon