Search results

Complex Data Binding with list of Array Of Objects in ASP.NET Core Grid control

The following example shows how to set Complex field for datasource having Array Of Objects.

tagHelper
complexarray.cs
<ejs-grid id="Grid" dataSource="@ViewBag.DataSource" height="315" >     
    <e-grid-columns>
        <e-grid-column field="EmployeeID" headerText="Employee ID" width="100"  textAlign="Right"></e-grid-column>
        <e-grid-column field="Name.0.FirstName" headerText="Last Name" width="120"></e-grid-column>               
        <e-grid-column field="Name.LastName" headerText="Last Name" width="100"></e-grid-column>
        <e-grid-column field="Title" headerText="Title" width="100"></e-grid-column>
    </e-grid-columns>
</ejs-grid>
public IActionResult Index()
{
    var ComplexData = ComplexData.GetAllRecords();
    ViewBag.DataSource = ComplexData;
    return View();
}