Charu
Charu

Reputation: 2749

what is the difference b/w @Html.DropDownList and @Html.DropDownListFor in MVC3

What is the difference between @Html.DropDownList and @Html.DropDownListFor in MVC3?

All I know is @Html.DropDownList is used to render a dropdownList with a List and @Html.DropDownListFor with a Model.

I am not sure if this is right or not.

Upvotes: 0

Views: 2088

Answers (1)

Sergei Rogovtcev
Sergei Rogovtcev

Reputation: 5832

DropDownList is bound to arbitrary value you pass in and generates input named after parameter you pass in.

DropDownListFor is bound to property in your model (defined by expression passed in) and generates input named after that property according to defined model binder condition.

Upvotes: 3

Related Questions