mercredi 23 mars 2016

how to change property of SelectListItem to selected using reflection

I have a list

    IEnumerable<SelectListItem> workingHoursList = new List<SelectListItem>()
            {
                new SelectListItem() {Text="08:00:00", Value="08:00:00"},
                new SelectListItem() {Text="09:00:00", Value="09:00:00"},
                new SelectListItem() {Text="10:00:00", Value="10:00:00"},
                new SelectListItem() {Text="11:00:00", Value="11:00:00"},
                new SelectListItem() {Text="12:00:00", Value="12:00:00"},
                new SelectListItem() {Text="13:00:00", Value="13:00:00"},
                new SelectListItem() {Text="14:00:00", Value="14:00:00"},
                new SelectListItem() {Text="15:00:00", Value="15:00:00"}
            };

and I would like to change the property of the SelectListItem to selected using reflection. How can I do it?





Aucun commentaire:

Enregistrer un commentaire