Displaying the HTML content

24 Feb 20221 minute to read

The HTML tags can be displayed in the Grid header and content by enabling the disableHtmlEncode property of e-grid-column tag helper.

<ejs-grid id="Grid" dataSource="@ViewBag.DataSource" height="135" allowPaging="true">
    <e-grid-columns>
        <e-grid-column field="OrderID" headerText="<span> Order ID </span>"  disableHtmlEncode="true" textAlign="Right" width="140"></e-grid-column>
        <e-grid-column field="CustomerID" headerText="<span> Customer ID </span>" disableHtmlEncode="false" width="120"></e-grid-column>                
        <e-grid-column field="OrderDate" headerText="Order Date" format='yMd' textAlign="Right" width="100"></e-grid-column>
        <e-grid-column field="ShipCity" headerText="Ship City" width="100"></e-grid-column>
    </e-grid-columns>
</ejs-grid>
public IActionResult Index()
{
    var Order = OrderDetails.GetAllRecords();
    ViewBag.DataSource = Order;
    return View();
}