質問

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?

役に立ちましたか?

解決

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

@Html.DropDownListFor( model => model.Student,
    new List<SelectListItem>() {
        new SelectListItem() { Text = "", Value = "" }
    })
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top