Frage

I have two DropDownListFors. With changing the first one's selected item, the second one's list changes. There's no problem til here.

The problem is I want the second list to be empty before the first change of the first DropDownListFor. How can I do this?

In short, how can I have a DropDownListFor with no items at first?

War es hilfreich?

Lösung

I think I found it. It was so simple. :)

@Html.DropDownListFor( model => model.Student,
    new List<SelectListItem>() {
        new SelectListItem() { Text = "", Value = "" }
    })
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top