I am trying to bind a List of items from memory to a Column on a Grid but the items don't appear:
<EjsGrid ModelType="@Model" DataSource="@lstEmpleados" AllowPaging="false" AllowSorting="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" Height="315">
<GridEditSettings Mode="@EditMode.Normal" AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
<GridEvents OnActionComplete="ActionComplete" TValue="ModelEmpleado"></GridEvents>
<GridColumns>
<GridColumn Field=@nameof(ModelEmpleado.EmpleadoID) HeaderText="Empleado ID" IsPrimaryKey="true" Width="80"></GridColumn>
<GridColumn Field=@nameof(ModelEmpleado.Nombre) HeaderText="Nombre" Width="120"></GridColumn>
<GridColumn Field=@nameof(ModelEmpleado.Apellido) HeaderText="Apellido" Width="120"></GridColumn>
<GridColumn Field=@nameof(ModelEmpleado.NombrePais) HeaderText="País" EditType="EditType.DropDownEdit"
ForeignKeyField="NombrePais" ForeignKeyValue="NombrePais" DataSource="@lstPaises" Width="120">
</GridColumn>
</GridColumns>
</EjsGrid>
@code {
public ModelEmpleado Model = new ModelEmpleado();
public List<clsPais> lstPaises { set; get; }
protected override async Task OnInitializedAsync()
{
lstPaises = new List<clsPais>() ;
lstPaises.Add(new clsPais(){ NombrePais="GUATEMALA", CodigoPais=502};
lstPaises.Add(new clsPais(){ NombrePais="EL SALVADOR", CodigoPais=503};
}
}
public class ModelEmpleado
{
public string EmpleadoID { set; get; }
public string NombrePais { set; get; }
public string Nombre { get; set; }
public string Apellido { get; set; }
}
Thanks