문제

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