Good Morning.
I am trying to fill a DropDownList from a model. The model is as follows:
public class StatusEnvioModel
{
public string Code{ get; set; }
public string Description { get; set; }
}
Then I create a List as follows:
public IEnumerable<StatusEnvioModel> ListaEstadosGuia = new List<StatusEnvioModel>()
{
new StatusEnvioModel {Code = "REP", Description = "Recogida en punto de venta" },
new StatusEnvioModel {Code = "RED", Description = "Envio recogido en domicilio" },
new StatusEnvioModel {Code = "IAC", Description = "Ingreso a Cedi" },
new StatusEnvioModel {Code = "RUT", Description = "En distribución" },
new StatusEnvioModel {Code = "SAD", Description = "Salida ciudad destino" },
new StatusEnvioModel {Code = "LTH", Description = "En transito" },
new StatusEnvioModel {Code = "IFE", Description = "Intento fallido de entrega" },
new StatusEnvioModel {Codigo = "ENT", Description = "Entregado" },
new StatusEnvioModel {Code = "IFP", Description = "Intento fallido de entrega en punto Venta" },
new StatusEnvioModel {Code = "EPV", Description = "Entregado en punto de venta" }
};
And then in the code define and initialize a property as follows:
protected List<StatusEnvioModel> EstatusGuia { get; set; } = new List<StatusEnvioModel>();
protected override async Task OnInitializedAsync()
{
EstatusGuia = AppData.ListaEstadosGuia.ToList<StatusEnvioModel>();
}
And in the page I put a DropDownList in the following way:
<div class="form-group">
<label for="TipoStatusDDL">
<span>Estatus guías <span class="k-required">*</span></span>
</label>
<TelerikDropDownList Id="TipoStatusDDL" Data="@EstatusGuia" TItem="Codigo" TValue="Descripcion"
Width="100%" PopupWidth="400px" DefaultText="Seleccione un estatus de guía" />
</div>
The problem is that I get an error in Data = "@ EstadusGuia" TItem = "Code" and TValue = "Description"
What is the problem?
Thank you.