New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Displaying Empty Cell When Min Date

Environment

Product Version2022.3.1109
ProductTelerik UI for ASP.NET Core Grid

Description

How can I display an empty string when the field value is the minimum Date value?

Solution

  1. Use a ClientTemplate for the pointed column.
  2. Call a JavaScript function in the ClientTemplate and pass the current dataItem as a parameter.
  3. In the function handler, initialize a custom variable with value the min one for the Date type.
  4. Add one day to the custom variable from point 3 to handle all the timezone transformations.
  5. Conditionally check if the date field of the dataItem has value less than the value of the custom variable.
  6. If the condition is results in true - return an empty string.
  7. Else - return the date value in the proper format.
  8. Here is an example:
Index.cshtml
columns.Bound(p => p.OrderDate).ClientTemplate("#=orderDetails(data)#");

More ASP.NET Core Grid Resources

See Also